C/C++ with GCC: Statically add resource files to executable/library
Does anybody have an idea how to statically compile any resource file right into the executable or the shared library file using GCC?For example I'd like to add image files that never change (and if...
View ArticleWhy do we use zero length array instead of pointers?
It's said that zero length array is for variable length structure, which I can understand. But what puzzle me is why we don't simply use a pointer, we can dereference and allocate a different size...
View Articleincluding static libraries with -all_load flag
In what cases exactly do you need -all_load flag?Lets say I have something likeg++ source.cpp -o test libA.a libB.a libC.aFrom what i recall if there is some reference to a symbol used in source.cpp...
View ArticleHow can I compile a library archive with a source code file with gcc?
TL;DR - I need to compile archive.a with test.o to make an executable.Background - I am trying to call a function in a separate library from a software package I am modifying but the function (a string...
View ArticleDoes gcc treat relaxed atomic operation as a Compiler-fence?
I have following code with GCC8.3 ,x86-64 linux:// file: inc.ccint inc_value(int* x) { (*x)++; //std::atomic<int> ww; //ww.load(std::memory_order_relaxed); (*x)++; return *x;}generates following...
View ArticleHow much of shared object is loaded to memory
If there is a shared object file say libComponent.so which is made up of two object files Component_1.o and Compononet_2.o.And there is an application which links to libComponent.so but is only using...
View ArticleCompiler code generation comparisons - GCC optimizing away a never-taken...
Ok, so all started here: Unsigned integer and unsigned char holding same value yet behaving differently why?I wrote the following application to understand what happens behind the scenes (ie, how the...
View Articleissues interleaving `#pragma` and `__attribute__` on GCC
BackgroundNote: This is not important for the questionI have some macros that act as slightly more general version of attributes, that I attach to functions. Depending on the compiler and compiler...
View ArticleCannot compile x86 in GCC crunchbang
I cannot seem to use GCC to compile C as x86. I am using crunchbang.Simple C test file:#include <stdio.h>int main(){ printf("Test x86");}When compiled with:gcc -o 64 test.cI get no errors or...
View ArticleHow to setup Geany using windows 7?
I just learned some C and I want to try it at home. The problem is that whenever I click build, an error like 'gcc' is not recognized as an internal or external command, operable program or batch...
View ArticleC++ - What can be done with internal compiler errors?
I encountered something interesting and annoying while programming a matrix class: internal compiler error. I was willing to invoke a sister constructor in the class called...
View ArticleHow to speed up compilation time in linux
While compiling under linux I use flag -j16 as i have 16 cores. I am just wondering if it makes any sense to use sth like -j32. Actually this is a quesiton about scheduling of processor time and if it...
View ArticleHow to make a cross compiler using gcc?
Though there are many tutorials online on how to make a cross compiler, I am actually not getting it.I am using fedora 16 and already have gcc installed. I am not sure about binutils. How do I make a...
View ArticleWhat does the gcc warning "project parameter passing for X changed in GCC...
I have a C++ project that builds fine and without warnings with gcc 7.2 on x86 Linux and Windows, I needed to port it to an ARM device so I tried to crosscompile it with an "arm-linux-gnueabihf" gcc...
View Articlehow to select a particular gcc-toolchain in clang?
Clang automatically selects the gcc-version with the highest version:$ clang++ -v main.cppclang version 3.8.1-12 (tags/RELEASE_381/final)Target: x86_64-pc-linux-gnuThread model: posixInstalledDir:...
View Articlecustomizing the gcc compiler to add a built-in preprocessor macro
I am trying to customize a particular release of gcc (gcc 11.4.0) to make a small change which I need to share with some other developers on github. To this end, I need to fork gcc to add a...
View ArticleWhy doesn't my c build work on my arch linux system, but does on Ubuntu...
Good morning !I'm currently working on a very simple game in c. So far, my build was working just fine. But since I've included game.h to application.h, I get the following error :Error...
View Articlebootloader _start VEZA video buffer [closed]
link the asm file to a kernel.c code.in the bootloader.asm , i addit the video mode for a screen.that nead it 1024*800 but next in nead video memory to add the bitmapto to fonts or pixsel drawing but i...
View ArticleHow to build gcc without bootstrap but with the specific compiler flags?
According to Installing GCC: BuildingI may use./configure --with-build-config=strip_configmakeIn config/strip_config I may overwrite build flags e.g.BOOT_CFLAGS := -s $(filter-out -g%,...
View ArticleHow to install gcc-arm-none-eabi on Mojave MacOS?
I'm using MacOS Mojave. I want to use gcc-arm-none-eabi for ergodox, but I cannot install it with brew.vikke@kosanji:~/vcswork/qmk_firmware[master]$ brew search gcc-arm-none-eabiNo formula or cask...
View Article