Embedded GCC optimization magic
I have a project in which I try to build a Firmware for a micro controller and try to get better control of the optimization flags used. I would like, instead of using the -O flag specify the different...
View ArticleEmbedding a program's source code into its binary using GCC for GDB's later use
I'm getting tired of having to keep my source code untouched until I'm through with its debugging. Any time I change my code, GDB starts complaining about it:warning: Source file is more recent than...
View ArticleSpecify number of bits to use for `enum` in C (compile error if a value...
Does not need to be portable. As long as it works for one compiler, I can make an ifdef to enable it only on that compiler. I'd prefer a GCC solution but any compiler is fine. I'm using C99.For...
View ArticleHow to impose predictive commoning on gcc to perform a computation reusing
According to an old slide about predictive commoning, one can say thattest1.cppfor(int i=0; i < n; i++) f[i]= a[i]*exp(i+1)+a[i+1]*exp(i+2); is equivalent totest2.cppdouble p0=a[0]*exp(1); int i;...
View ArticleGCC C++ ABI Compatibility (RHEL/CentOS devtoolset)
I'm looking to better understand the ABI compatibility of the compiled output from GCC for C++ code, from both a 'standard' Linux installation, but also that of the devtoolset software collection's...
View ArticleCannot match rvalue reference function with GCC
When attempting to use an rvalue reference, I get the following error from GCC (clang does not generate an error):/usr/include/c++/8/istream:951:12: error: no match for ‘operator>>’ (operand...
View ArticleCompiling without main function (MacOS)
So I am trying to compile ,link and run a program without the main function.This is the code:#include <stdio.h> #include <stdlib.h> int my_main() { printf("Hello world!\n"); return 0; }...
View ArticleHeader search paths with gcc using C_INCLUDE_PATH
i'm confused about the following include files(with GCC)i've A.c and B.c in folder AAAand B.h in folder BBBin A.c:#include <stdio.h> #include "B.h" main() { errPrint(); } in B.c:#include...
View ArticleHow to install GCC/G++ 8 on CentOS
I'm used to install packages on Debian/Ubuntu distributions, but now I need to install gcc and g++ version 8.*. There is only version 4.* in CentOS repositories. What's the correct way to install them...
View ArticleCan't install SDL on MinGW, getting `undefined reference to WinMain@16`
I'm trying to install SDL on MinGW. I've downloaded SDL from here (the SDL2-devel-2.0.0-mingw.tar.gz link), then copied the contents of SDL2-2.0.0/x86_64-w64-mingw32/{bin,include,lib} into the matching...
View ArticleCan't compile java code using gcj compiler. error: cannot find -liconv
I am testing GNU java compiler. I had installed it from mingw installation manager. When I simply run command "gcj --main=Test Test.java" it gives me following...
View Articlemingw32/bin/ld.exe ... undefined reference to [class] ... collect2.exe:...
Problem description while I am trying to move my code from Linux to Windows:MinGW on Windows linker problemshappens when I am calling a user-defined class inside my Main.cpp ( works fine if I do not...
View ArticleHow to use distcc to preprocess and compile everything remotely only?
Background:I have a 128-core server which I would like to use as a build server. I have a bunch of client machines which work with a not-so-new and not-so-powerful PC. (Can't upgrade! Not in my...
View Articleerror: use of deleted function bool regex_match with gcc 5.2.0
The code compiled with GCC 4.9.2 without even any warning, but shows the following error in GCC 5.2.0:error: use of deleted function ‘bool std::regex_match(const std::__cxx11::basic_string<_Ch_type,...
View Articleif constexpr gcc bug
I noticed my code base not longer compiling with gcc.I was able to reduce the problem to the followingstruct bar { int foo(){return 0;} }; int foobar() { if constexpr(true) { return 0; } else { return...
View ArticleIs there a 128 bit integer in gcc?
I want a 128 bit integer because I want to store results of multiplication of two 64 bit numbers. Is there any such thing in gcc 4.4 and above?
View ArticleDoes arm-none-eabi-gcc produce slower code than Keil uVision
I have a simple blinking led program running on STM32f103C8 (without initialization boilerplate):void soft_delay(void) { for (volatile uint32_t i=0; i<2000000; ++i) { } } uint32_t iters = 0; while...
View Articlehow to print __uint128_t number using gcc?
Is there PRIu128 that behaves similar to PRIu64 from <inttypes.h>:printf("%" PRIu64 "\n", some_uint64_value); Or converting manually digit by digit:int print_uint128(uint128_t n) { if (n == 0)...
View ArticleMAC: Qt Cannot detect toolkit
How I can configure QT Project using Qt 5.12.1/Qt Creator 4.8.1 I need compile my project for mac os. I tryed with QT Creator, then, below problem occur.Or compile with below command.qmake make But,...
View ArticleCompiling errors while calling x86 asm function in c but not in x64 [duplicate]
Sorry for my language mistakes . My OS is Windows.My computer has 64 bit processor.I should call an Intel x86/x64 assembly function in c code.I should write two asm functions (intel x64 and x86) and...
View Article