Char conversion in gcc
What are the char implicit typecasting rules? The following code gives an awkward output of -172.char x = 200;char y = 140;printf("%d", x+y);My guess is that being signed, x is casted into 72, and y is...
View ArticleCross compilation for gpsd shows "unrecognized option"
I am cross-compiling gpsd3.20 on my Ubuntu 16.04 for the ARM architecture. As you may know, gpsd uses Sconsctruct to compile the source codes. During my cross-compilation, the moment when it needs to...
View ArticleCompiler to C++20 on Windows
I need a compiler that supports c++20, like GCC 10.1 (used on linux), but to use it in my Windows 10.I saw posts that recommend Mingw-w64, but does it supports c++20?
View ArticleVS Code will not build c++ programs with multiple .ccp source files
Note that I'm using VS Code on Ubuntu 17.10 and using the GCC Compiler.I'm having trouble building a simple program which makes use of additional .ccp files. I'm probably missing something obvious here...
View ArticleIs it possible to put a bunch of -Wno_... gcc flags into a file and reference...
gcc has so many warning options, and I want to turn a bunch of them off (I'm compiling a ton of old code that's known to work, but generates lots of warnings). I suppose I could turn off all warnings,...
View ArticleWhy c++ program generating different output for the same input?
I am implementing matrix chain multiplication program in c++. I am using ONLINE_JUDGE flag to write output to the file. When i run the program it does not produce correct output in file, but it is...
View ArticleHow can I use gcc to compile C program whose name does not end with ".c"?
Compiling C program using gcc is very simple. Just such a command:gcc code.c -o executableHowever, if the code file name does not end with ".c", gcc will treat it as a linker script. How can I use gcc...
View ArticleDo we have C++20 ranges library in GCC 9?
Do we have support for C++20 ranges library in the newly released GCC 9?I copied the example code below for ranges library from: https://en.cppreference.com/w/cpp/ranges#include <vector>#include...
View ArticleUndefined reference ipp libraries eclipse using minGW C++ linker [duplicate]
I'm trying to run a c++ program on eclipse using intel ipp libraries. I already link the libraries on eclipse like this StackOverflow answer: Eclipse C++ undefined reference . Although, I am still...
View Articleld OS X: unknown option -z
I'm trying to compile a particular package for multi simulation called MUSIC (https://github.com/INCF/MUSIC). I didn't have any problems to compile it on ubuntu but when I try to compile it on os x I...
View Articlewhat are the valid sanitizer suppression strings for gcc?
When using sanitizers with gcc one can provide a list of exceptions/suppressions to deal with false positives and such.the suppression file format is poorly documented.Each suppression is of the...
View ArticleLibrary to Compile a C Program from a C Program [closed]
Other than running gcc using execv() or system() is there a library that exposes a function call to compile a char buffer containing C code into a new buffer containing the compiled assembly symbols /...
View Article'cc' is not recognized as an internal or external command [closed]
So I'm trying to compile a C program into a shared library on Windows 10:I'm trying this compile command from my cmd terminal:cc -fPIC -shared -o libtest.c test.cIt is based off the command given here:...
View ArticleGcc objcopy get reasonable size binary
I am trying to create a binary from elf file with PPC GCC, I understand the the objcopy will create the whole area for the memory sections. here is my sample ld file: MEMORY { RESETWORD: ORIGIN =...
View ArticleHow to simulate memory allocation errors
My C application uses 3rd libraries, which do their own memory management.In order to be robust, my application has code to deal with failures of library functions due to lack of free memory.I would...
View ArticleUndefined references when compiling glfw programs
I am trying to compile this test program from glfw's docs://test.c#include <GLFW/glfw3.h>int main(void){ GLFWwindow* window; /* Initialize the library */ if (!glfwInit()) return -1; /* Create a...
View ArticleWhy C++ Template function `auto` return type deduction fails on GCC but works...
I am trying to build the following code:#include <functional>#include <iostream>#include <limits>#include <locale>#include <sstream>#include <string>#include...
View ArticleHow do I get GCC (C++) to stop simplifying arithmetic expressions?
I'm making a bit of a physics engine for fun.I'm trying to make it reliable even at low tickrates, so I'm doing a dangerous dance with float arithmetic and precision.While debugging, I ended up running...
View ArticleWhat does gcc (and clang) do if you specify more than one optimization flag...
The build system is impossible to figure out, although it IS possible to configure an additional flag: In trying to do some quick-and-dirty tests, I'm able to inject an additional -O3 flag to see how...
View ArticleCompiling C code is drastically slower since macOS Sierra on MacBook Pro 2015
Since macOS Sierra, compiling C code with clang or gcc is really, really slow.Reinstalling El Capitan (even today) solves the issue.Building on GNU/Linux is much faster.Building on Windows AND on WSL...
View Article