Skip to content
Advertisement

Tag: gcc

Is errno thread-safe?

In errno.h, this variable is declared as extern int errno; so my question is, is it safe to check errno value after some calls or use perror() in multi-threaded code. Is this a thread safe variable? If not, then whats the alternative ? I am using linux with gcc on x86 architecture. Answer Yes, it is thread safe. On Linux,

Static link of shared library function in gcc

How can I link a shared library function statically in gcc? Answer Refer to: http://www.linuxquestions.org/questions/linux-newbie-8/forcing-static-linking-of-shared-libraries-696714/ You need the static version of the library to link it. A shared library is actually an executable in a special format with entry points specified (and some sticky addressing issues included). It does not have all the information needed to link statically. You can’t

How can I add a default include path for GCC in Linux?

I’d like GCC to include files from $HOME/include in addition to the usual include directories, but there doesn’t seem to be an analogue to $LD_LIBRARY_PATH. I know I can just add the include directory at command line when compiling (or in the makefile), but I’d really like a universal approach here, as in the library case. Answer Try setting C_INCLUDE_PATH

ld cannot find an existing library

I am attempting to link an application with g++ on this Debian lenny system. ld is complaining it cannot find specified libraries. The specific example here is ImageMagick, but I am having similar problems with a few other libraries too. I am calling the linker with: ld complains: However, libmagic exists: How do I diagnose this problem further, and what

Advertisement