I implemented a function with variable arguments below: Then I hope to implement another named “errExit()” based on the function above. I just tried like below.It works as I hoped but I dont’t think it correct. I tried errExit(“hello,%s,%s,%s”, “arg1″,”arg2̶…
Tag: gcc
compile official doc “Embedding Python in Another Application” example failed
I am trying to compile and run the example from https://docs.python.org/3/extending/embedding.html#very-high-level-embedding , but failed. My environment is Ubuntu 20.04.2 LTS, with system shipped python3.8(statically built), libpython3-dev and libpython3.8-dev packages installed. What I’ve tried: main.…
why does the local array has extra empty location at the end(c/c++/gcc)?
Check below program, In the above program, even though array size is 10, after the first array there is exactly 6 extra locations reserved in the stack (12bytes), I am wondering why this extra space got reserved? and this extra space size is varying for different size(Its not 12 for size 20). Can anybody expl…
Why does this nostdlib C++ code segfault when I call a function with a thread local variable? But not with a global var or when I access members?
Assembly included. This weekend I tried to get my own small library running without any C libs and the thread local stuff is giving me problems. Below you can see I created a struct called Try1 (because it’s my first attempt!) If I set the thread local variable and use it, the code seems to execute fine…
Compiler cannot find header file within header file in C++
I have a header file provided by yaml-cpp library, yaml.h yaml.h: main.cpp All the header files are in the same directory (/home/user/application/libs/yaml-cpp/include), but the compiler is unable to find parser.h and all the other includes. Why is this so and how do I fix it? I have tried using g++ -I/home/u…
Compiler version in C++ vs pre-compiled C libraries
I have a code that uses std=c++20. I want to use a C library that was build with old gcc version. Should I recompile the C library using the same compiler ? If no, how could you judge that the 2 ABIs are compatible? Answer There should be no problem using the library as it is. Don’t forget to add
gnu ld treating assembly output as linker script, how to fix? or am i doing something wrong in my compiling?
i’ve been working on my kernel project and to simulate it (that is to run it on QEMU), i need it as a .iso file. I have an assembly file and to assemble it – as –32 boot.s -o boot.o and for the main code (which is in c++), to compile it – gcc -S kernel.cpp -lstdc++ -o kernel.o gives
Method is both defined and undefined in a static Linux library
I’m using visual studio 2019 and compiling for ARM android. One of the twelve libraries in my solution is failing to link properly. It is showing a sizable number of class methods that are both defined and undefined. Here is one example using the command line: nm -C -g Services_Droid.a 1>Services_Dro…
Understanding ELF64 text/data segment layout/padding
I’m trying to brush up on UNIX viruses and one text I’m reading mentions that parasitic code can be inserted in the padding between the text and the data segment, supposedly up to 2MB in size on x86-64 systems. But when I compile a simple hello world program with gcc -no-pie… …and insp…
Stringizing / stringify name mangling
I load a path name with cmake and want to use as a string in my C++ program to load some data. For this the stringification operator # is really handy – I use the macro provided in this answer which is the same as here. Now when I have “linux” or “unix” in my path, this goes horr…