Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Browsing all 22022 articles
Browse latest View live
↧

CMake: use a custom linker

I want to setup a custom toolchain with cmake. I've set the compiler but I don't know how to set the linker. This error is reported because cmake try to use the compiler to link:The C compiler...

View Article


How exactly does __attribute__((constructor)) work?

It seems pretty clear that it is supposed to set things up.When exactly does it run?Why are there two parentheses?Is __attribute__ a function? A macro? Syntax?Does this work in C? C++?Does the function...

View Article


How to use static assert in C to check the types of parameters passed to a macro

I need to write a C macro that checks to ensure all parameters passed to it are unsigned and of the same integer type. Ex: all input params are uint8_t, or all uint16_t, or all uint32_t, or all...

View Article

How to make GCC create checksum-same builds?

In company where I work there is complicated industrial ARM arch router project, consisting primarily of many C and C++ apps with Linux kernel. Currently we are preparing to certification and...

View Article

For a given source file, how to see the chain of #include substitutions a...

This is almost a duplicate of C/C++: How to figure out the chain of header files for a given definition?, but the difference is that I do not use Visual Studio, in my case the platform is Unix-based...

View Article


GCC: --whole-archive and --no-whole-archive options

I am creating a shared object library from two *.a (static libraries) using GCC. I referred these articles:How to force gcc to link an unused static libraryHow to include all objects of an archive in a...

View Article

GCC gives "undefined reference" error to extern variable [closed]

I know this question has been asked several times, but none of the solutions worked for me. That's why I created a new question.I'm trying to add the custom charging driver ThunderCharge to my kernel....

View Article

VAlue/Purpose of __attribute((const)) in gcc c++

Is there any value in using __attribute((const)) in gcc for c++ programs when declaring functions or static members that the compiler can see do not access global memory?For example, int Add( int x ,...

View Article


How to add MInGW to Clion IDE on Linux environmnet [duplicate]

I have two files in one folder.a.ccb.cceveryone have:int main(int argc, char *argv[]) { QCoreApplication application(argc, argv); return 0; } One Cmake file with:find_package(Qt5 COMPONENTS Core...

View Article


If GCC only finds a static library and not a dynamic one, does it resort to...

Please consider the following command:gcc myfile.c -o myapp.exe -Lmydir -lmylib mydir inclues the following file:`libmylib.a` I know that by default, gcc wants to do dyanmic linking. However, as you...

View Article

Custom ELF sections for attaching stringy metadata

I would like to be able to associate some stringy, easily-extractible key-value pairs with my ELF executables.I've noticed gcc-compiled ELFs have a .comment section$ readelf -p .comment a.out So I...

View Article

Is there any way to create compiled files for another OS?

Context: I have a machine in the cloud running mysql 5.7 in a virtualized Debian OS. I am actually using a MAC OS to development and I need to compile a shared object (.so) to this mysql instance.Is...

View Article

GCC 6.3 throws a runtime error whenever the input is more than one number....

This a preliminary attempt to solve the Bytelandian Gold Coin problem in CodeChef.int main(void) { long long int n = -1; scanf("%lld", &n); while(n != -1){ int b[n]; for(int i=0; i<n; i++) b[i]...

View Article


Why is the difference between a task_struct pointer and a field inside that...

This statement:pr_err("init=%p head=%p offset=%zd\n", &init_task, &init_task.thread_group, offsetof(struct task_struct, thread_group)); produces this output when compiled into a kernel module...

View Article

Cython openMP in OSX... no build

I 'm fighting 3 days now to setup my venv... I need cython, openmp.... My IDE is PyCharm Prof in macOS... I have tried plenty solutions with no result...when i try to build with PyCharm... the building...

View Article


Copying value from an x86 register to a memory location which is given by a...

Assuming I have a memory location that I want to copy data to, and I have that address in a pointer, Is it possible to copy data at that location via MOV instruction and inline assembly.Or basically...

View Article

How is "__builtin_va_list" implemented?

I want to delve into the implementation of function "printf" in C on macOS. "printf" uses the <stdarg.h> header file. I open the <stdarg.h> file and find that va_list is just a macro.So, I...

View Article


Efficient ways to implement in/out instructions in C/ higher level languages

Here are my "vanilla" assembly routines:read_port: mov edx, [esp + 4] in al, dx ret write_port: mov edx, [esp + 4] mov eax, [esp + 4 + 4] out dx, al ret read_port_word: ;Btw is there a better way to do...

View Article

Why can I create user defined structured bindings for glm::vec in MSVC and...

I've been using code similar to the following in MSVC projects for the last year or so, and ran into an issue trying to use it with g++. #include <utility> #include <glm/glm.hpp> namespace...

View Article

uint64_t or int64_t not found error when compiling gcc-7.3.0

I am building my own linux system from scratch.As I am a beginner I don't know much about the error, and I've tried some ways, but still I am unable to solve this. I came across a step to compile...

View Article
Browsing all 22022 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>