Quantcast
Browsing all 22045 articles
Browse latest View live

How to correct stack location arm-none-eabi-gcc?

I try to create a bare metal code using the standard lib C. I started with an assembly code .section .isr_vector .global _Reset _Reset: B Reset_Handler /* Reset */ B . /* Undefined */ B . /* SWI */ B ....

View Article


Get AVR with gcc running on fedora

im trying to solve this issue for a few days now and i cant find any solution. I got myself an Atmega88A and i want to program it on fedora. I tried to program C with gcc and that went well. But as i...

View Article


gcc compiler says constant variables are not constant [duplicate]

I have a project with a lot of c-Files with statements like the following:static const uint8_t MOD_BIT_POS = 10; static const uint16_t MOD_SHUTDOWN = 0x0001 << MOD_BIT_POS; When I try to compile...

View Article

The output prints the scan functions twice, not once. Needs fixing

The code I have here works great:#include <stdio.h> #include <stdlib.h> #include <math.h> int* get_data(int num_grades); float calc_average(int num_grades, int grades[]); void...

View Article

How can I fix the vi editor in Cygwin?

recently I was trying to run a c program using cygwin. The program called for a function fopen_s(). After compiling, I kept getting errors that this function did not exist. I did a bunch of trouble...

View Article


Unable to build c code in visual studio code

1) using tmd-gcc 2) path is set getting These errors while trying to Build the program

View Article

Using inline assembly in c to check for the largest value in a 32-bit integer...

I'm attempting to find the maximum element in an integer array using inline assembly in c. Below is my attempted solution with comments attached showing my logic.My attempt:static inline int max_elem()...

View Article

What is the difference between g++ and gcc?

What is the difference between g++ and gcc? Which one of them should be used for general c++ development?

View Article


Does one still need to use -fPIC when compiling with GCC?

On gcc target machines, when one wanted to compile a shared library, one would need to specify -fpic or -fPIC to get things to work correcly. This is because by default absolute addressing was used,...

View Article


pure function, why there is no optimisation?

I tried recent versions of gcc (9.2.1) and clang (9.0.1) for such code://pure.cpp int square (int x) __attribute__ ((pure)); int square (int x) { return x * x; } //test.cpp #include <stdio.h> int...

View Article

Building GCC-Ada, Syntax error compiling s-excmac.adb with very old gnatmake

I'm trying to update our 20-year old Ada compiler, however you need an Ada-compiler to build some parts of GCC+Ada (9.2.0). The gnatmake is circa 2000, and it's possibly sub-calling GCC 2.8.1. Sigh.I...

View Article

Return brace-enclosed initializer list as struct

Giving below simplified code compiled with g++ -c test.cpp or g++ -std=c++17 -c test.cpp#include <cstddef> struct sd_bus_vtable { union { struct { size_t element_size; } start; struct { const...

View Article

Loading resultant character after lodsb instruction (in-line assembly in c)

I'm trying to mess around with strings in inline asm for c. I was able to understand how strcpy works (shown below):static inline char *strcpy(char *dest, char *src) { int d0, d1, d2; char temp; asm...

View Article


Determine number or character in textfile C

I have a textfile with these following numbers and characters inside of it.36@xL!?\8 28?&gt;\4 42&lt;pX%7 37@#5 31kL%^?&gt;\&lt;#%5 Now, i want to get the first integer which is 36 and...

View Article

Copy a byte to another register in GNU C inline asm, where the compiler...

I'm trying to mess around with strings in inline asm for c. I was able to understand how strcpy works (shown below):static inline char *strcpy(char *dest, char *src) { int d0, d1, d2; char temp; asm...

View Article


Compiling gcov.c file with local changes

How can we compile gcov.c file at our end. Googled it, but didn't get much information. When I tried to compile getting below error. gcc gcov.c gcov.c:33:20: fatal error: config.h: No such file or...

View Article

Problem in GCC/C++17 with template template class

Consider the 2 following overloadstemplate<typename T> bool test() { return true; } template<template<typename ...> class T> bool test() { return false; } The 1st one works for...

View Article


Strange decompilation when using gcc with different optimization

I am running on linux 5.4.18-1-MANJARO with gcc version 9.2.0 (GCC)Filename:a.c#include<stdio.h> int main(void) { int a; scanf("%d", &a); if (a < 5 || a > 6) puts("fail"); else...

View Article

GCC Cross-Compiler Cygwin64: GFDL license tm.texi

Following this tutorial: http://wiki.osdev.org/GCC_Cross-Compiler. (I'm also using Cygwin64.) When running "make install-gcc" i recieve the message:Verify that you have permission to grant a GFDL...

View Article

Why is this simple multithreaded program freezing in eclipse - mingw32/gdb?

The program below keeps hanging/freezing in GDB 7.4 (MinGW32, Eclipse, Windows) absolutely randomly, estimating about every 5 or 6 runs. It is most easily found by mashing the debug button in eclipse...

View Article
Browsing all 22045 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>