Fix gcc warnings with _Generic macro and compound literals
I have a struct with a union and an enum of its kind in it. I've made a macro that outputs a compound literal of the struct, that sets the kind and the data of the union according to the type passed to...
View ArticleOneliner to compile multiple executables only with gcc
We can compile multiple source files with only one main function to the executable one:$ gcc -o main main.c sub.cIf we have source files with multiple main functions, how possibly to compile multiple...
View Articlewhat do the # numbers in *.i files represent [duplicate]
I want know about the steps of execution of c program. I got this intermediate file which i can't understand what are these numbers in the screenshot represent and what exactly that line it do.# 1...
View Articlei can't compile with arm-none-eabi-gcc
I am trying to compile code with arm-none-eabi-gcc, but I get the following errors. Can someone help me or explain to me what is the possible reason?Thank...
View ArticleError when I compile 'hello-world' example from Contiki
I have installed the Contiki OS sources, and the ARM GCC compiler by doing brew install arm-none-eabi-gcc. However, when I try to run the hello world example in Contiki's example folder using the...
View ArticleHow to get rid of `deprecated conversion from string constant to ‘char*’`...
So I'm working on an exceedingly large codebase, and recently upgraded to gcc 4.3, which now triggers this warning:warning: deprecated conversion from string constant to ‘char*’Obviously, the correct...
View ArticleHow to build a static boost library?
More specifically static boost::iostreams with zlib (aka libz) support.The problem is, that when I try to link static library it throws unresolved symbols. At the same time when I try to link dynamic...
View Articlewith the -Ofast flag on gcc does breaking down a math expression (multiply...
i want to know with -Ofast flag on gcc if x += (a * b) + (c * d) + (e * f);is faster/slower/the same as/thanx += a * b;x += b * c; x += e * f;I have a math expression like this inside of a nested loop...
View Articleafter installing UnrealEngine in Ubuntu and 'make' command compiler give...
'ThirdParty/Linux/LibCxx/include/c++/v1/__locale:21:10: fatal error: 'locale.h' file not found#include <locale.h>The worst thing is that I cannot compile any .cpp file. It gives me this error...
View ArticleExecute binaries / tests on host that are built by non-host toolchain
Scenario:We would like to build our sources by an external / hermetic toolchain so all includes, libs and tools from the host are ignoredTo do so, a new toolchain is introduced to Bazel-Configuration....
View ArticleDecrementing stack by 24 when only 8 bytes are needed?
I have the C code:long fib(long n) { if (n < 2) return 1; return fib(n-1) + fib(n-2);}int main(int argc, char** argv) { return 0;}which I compiled by running gcc -O0 -fno-optimize-sibling-calls -S...
View ArticleHow to merge statics for all instances of header-defined inline function?
Having a header that defines some static inline function that contains static variables in it, how to achieve merging of identical static local variables across all TUs that comprise final loadable...
View ArticleGCC Compare String IF else ( A way to verify that you have written a certain...
I'm learning at GCC and while I was trying various solutions to verify the entry of a certain word, IF Word = Word {do something;}It seems that in C it cannot be done directly and so I tried this...
View ArticleShould a definition inside template class be instantiated if it is not used?
template <typename T>struct A{ static constexpr T obj {}; static constexpr bool noexcept_copy = noexcept( T{obj} ); static void UsesCopy() { T{obj}; } static constexpr int C = 1;};struct NoCopy{...
View ArticleWhy would g++ compiled code write beyond stack pointer?
To better understand assembly, I compiled a simple C++ program using g++ and then used gdbgui to step through the execution. I made a graphic of the state of the stack and registers at several...
View ArticleTrying to compile with gcc on Mojave. The compiler cannot read the includes...
gcc -g -ansi -c test_scroll_images_3x.c -I /opt/X11/include/X11test_scroll_images_3x.c:17:11: fatal error: 'X11/Xlib.h' file not foundinclude ^~~~~~~~~~~~1 error generated.I have several subroutines...
View ArticleRemove last character of std::string_view
I'm trying to remove the last character of an std string view, but no matter what I do it remains there. I think its because I'm accidentally removing the "/0" instead of the desired "]".Here is my...
View ArticleSOLVED: GCC Compare String IF else ( A way to verify that you have written a...
I'm learning at GCC and while I was trying various solutions to verify the entry of a certain word, IF Word = Word {do something;}It seems that in C it cannot be done directly and so I tried this...
View ArticleI downloaded mingw-w64-v7.0.0, but I don't know how to build it, can't find...
The system is win10 64 bits, do not know how to build, there is a doc description, but because of the poor English ability, and the translation software after the translation of the content of the...
View ArticleCrossWork for ARM and AT91Sam9263 - Optimization problem
I'm using CrossStudio for ARM v4.6 IDE for programming AT91SAM9263 microprocessor. When I use externally executable project with .elf file compiled by arm-elf-gcc on Linux it works fine.The same code...
View Article