What is the difference between 'asm', '__asm' and '__asm__'?
As far as I can tell, the only difference between __asm { ... }; and __asm__("..."); is that the first uses mov eax, var and the second uses movl %0, %%eax with :"=r" (var) at the end. What other...
View ArticleRISC V linker cannot find -lgcc
I'm trying to compile C code for GCC, but the linker is unable to find libgcc.I want to compile some simple tests for an RV32I core.When I try to use the modulo operator, GCC generates a call to the...
View Articlegcc compiles my Qt class with vtable undefined
I cannot get rid of the error "Undefined reference to vtable" when compiling my Linux desktop application.I did find the threadUndefined reference to vtableI have aset(CMAKE_AUTOMOC ON)in my...
View Articledifference between gcc -D_FORTIFY_SOURCE=1 and -D_FORTIFY_SOURCE=2
Can someone point out the difference between gcc -D_FORTIFY_SOURCE=1 and -D_FORTIFY_SOURCE=2? I guess =2 is more secure? I haven't been able to find a list which lists differences point by point.I have...
View Article[cgo]Python C API Error: undefined reference to 'Py_True'
Environment:Ubuntu20.04,Golang 1.9.2,Python 3.7.10I am trying to use this package: https://github.com/DataDog/go-python3The problem happened when 'go get github.com/DataDog/go-python3' was executed.By...
View ArticleCross Compillation for Raspberry PI
I am trying to cross-compile odas library for Raspberry PI. The code actually builds out of the box on the platform (either Raspberry PI, or Ubuntu box). However, when I am trying to cross compile the...
View ArticleCortex M0+/GCC Division with Rounding
I'm trying to implement an integer division with rounding. Obviously, by default integer division does floor and I was thinking I could use the remainder to determine if I should add 1 to my...
View Articlegcc is still not recognized in my command prompt even after adding path to...
I have added the path to eviornmental variables but gcc is still not recognized.enter image description hereI don't know how to fix my compiler
View ArticleDiscrepancy in outputs of `size` and `objdump`?
I have compiled the following C function (in sum.c) into object code:int sum(int a, int b){ return (a + b);}usinggcc -c sum.cWhen I check the sizes of different sections using size:size sum.o text data...
View ArticleWould g++ precompiler recover after reaching an "unknown" pragma directive?
Encountered an inexplicable situation trying to build a Linux project with Visual Studio Professional 2019: some preprocessor switches seemed to be ignored by g++ preprocessor -in header files...
View ArticleGCC wrong `missing initializer for member ` warning?
I'm trying to run the following code in my project:#include <memory>enum class Type{ SpecificType};struct BaseData{ using Ptr = std::unique_ptr<BaseData>; BaseData(Type type) noexcept :...
View ArticleMember variable allocated at start of memory
I'm trying to use c++ on an STM32 device compiling with gcc. The device loads the code and start executing it but hard faults on any member variable write.I can see with GDB that member variables are...
View Articlegcc tdm 10.3.0 get missing header files
I downloaded tdm gcc 10.3.0 and installed it succesfully. I have a file I want to compile yet it is missing header files. Is there a way to add components to tdm gcc from an interface, or do I download...
View ArticleThere are two types of dynamic linking. What are they named? [closed]
There are two ways a library can be linked dynamically in C/C++. This question is not about static linking where the lib is embedded into the executable. I am using Linux but I know under Windows the...
View ArticleFailing to compile a multifile program in c with make
I am trying to compile the following multi-file program (taken from the book Programming: a Modern approach, second edition By K. N. King) with a Makefile, but the compilation fails and I get the...
View ArticleHow to enable the highest warning level in GCC compiler(Boost is heavily used)
I just read a book which recommends enable the highest warning level in GCC. I just check the doc online, and found there are too much parameters. I want to enable the highest warning level, which...
View ArticleGCC, G++ how to turn character too long warning into error
I am writing a huge code base for webservices backends in C++, my frontend is in Javascript, so I tend to write some frontend code and then go back to C++ code, more often then I would like, I write...
View ArticleC macros: Jump to next label (using __COUNTER__?)
Context: I am trying to create macros to create some efficient coroutines. In my concept, the function has multiple passes (running, cleaning, checking). Currently I implement it using switch/case The...
View ArticleC++ runtime error invalid vptr when compiling with gcc 8.1 and gcc 8.2
I have a strange runtime error that only happens with GCC 8.2 and GCC 8.1.When attempting to delete a class with multiple inheritances, the compiler raises a runtime error related to a corrupted...
View Articleg++ compilation failed; only default headers seem to be the problem
This seems like a problem that's really hard to google! Which is why I finally came here after so long. I was compiling the updated Half-Life SDK, and I get approx. 4000 lines of errors, all within...
View Article