linker

Compiler/Linking Error: Freedup

I've been trying to compile a program for hardlinking duplicate files called freedup. I did try to email the author/maintainer of the program, but it's been a long time and I haven't heard anything back from him. I'm trying to compile the program from a cygwin environment using the latest stable versions of gcc (3.4.4-999) and make (3.8...

Replacing a function definition in C

Possible Duplicate: What is the best solution to replace a new memory allocator in an existing code? I'm writing a library in C. I'd like to know if there is a way to divert every malloc() call my library makes to a different "augmented" testmalloc() function that I provide without (significantly) modifying my library. This qu...

CMake: use a custom linker

Hi! I want to setup a custom toolchain with qmake. 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 "xgcc.exe" is not able to compile a simple test program. Here there is a snippet of my toolchain file # specify the cross compiler INCLUD...

Help on linking in gcc

In Microsoft visual c++ compiler, you can specify linker options using #pragma comment(lib, "MSVCRT") //links with the MVCRT library see this page I find this feature very useful because linker errors are common and i want to just place all the linker options in my source code instead of specifying them to the compiler. question: I...

Static (iPhone) libraries, distribution, and dependencies

(Presumably the following question is not iPhone specific, aside from the fact that we would likely use a Framework or dynamic library otherwise.) I am building a proprietary iPhone SDK for a client, to integrate with their web back-end. Since we don't want to distribute the source code to customers, we need to distribute the SDK as a s...

How to prevent a globally overridden "new" operator from being linked in from external library

In our iPhone XCode 3.2.1 project, we're linking in 2 external static C++ libraries, libBlue.a and libGreen.a. libBlue.a globally overrides the "new" operator for it's own memory management. However, when we build our project, libGreen.a winds up using libBlue's new operator, which results in a crash (presumably because libBlue.a is maki...

Linker can not find static library in same directory

I'm porting some Visual Studio 2008/VC9 stuff to Code::Blocks/MinGW and for some reason the linker cannot find a static library from another project in the workspace. In Visual Studio 2008 I could just set the static lib project as a dependency, and it would build in the right order (i.e. static lib needs to be built before linking the ...

Auto linking dependencies of a static lib

I have a static lib A, which also uses static libs B, C and D. I then have applications X and Y which both use A, but not B, C or D. Is there some way to make it so X and Y will automatically see that A used B, C and D and link them, so that I don't need to keep track for the entire dependency tree so I can explicitly pass every static...

g++ linker segment

Hi, Is it possible to specify what linker segment that a piece of code in a c++ source file will reside in? For example, int foo() { ... } ---> place in Link Segment A int bar() { ... } ---> place in Link Segment B I vaguely recall some source code like the following codea_ int foo () { ... } Any ideas? Thanks! ...

Linking 32-bit libraries to a 64-bit .NET application and memory consumption

I was compiling a .NET application targeting x86-64; however, the application references a 32-bit dll. The executable compiles fine, but Visual Studio throws a warning: Referenced assemply 'path/to/dll' targets a different processor than the application. Now, my understanding has been that you can't simply link a 64-bit executable...

Undefined symbols error in C++ / Eclipse

I have a function to display the values of a vector in a table, but I keep getting an "Undefined symbols" error when linking. Here is my function prototype: void displayVectors(vector<string> & nameVec, vector<double> & scoreVec, vector<char> & gradeVec); Here is the definition: void dipslayVectors(vector<string> & nameVec, vector<d...

std namespace vs. _STL namespace link problems

I am trying to link something I wrote to an existing shared library. I using gcc 3.2.3 on RedHat 3. When I get to the link phase I get an error that says: object_files_linux/hvm_example.o(.text+0x233):~/hvm_example.cpp:254: undefined reference to `xoc::hvmapi::id(std::basic_string, std::allocator > const&)' I have run the nm command on...

How to use OpenSSL in GCC

I'm tring to use openssl in a gcc program but it isn't working. g++ server.cpp /usr/lib/libssl.a -o server gives error, anything with -l option gives error, what should I type on command line to use openssl. The file /usr/lib/libssl.a exists, but still linker error no such funtion MD5() exists occurs. ...

Ubuntu Linux Library Path

How do I determine the Ubuntu Linux Library Path? That is, how does the linker know where to got to grab the object files when linking my program? ...

GD Visual C++ 2008

Is there some step by step guide to link GD library ( www.libgd.org ) to the project in MSVS? Because I'm getting linker-errors when trying to compile my project: error LNK2019: unresolved external symbol _gdImageCreateFromJpeg referenced in function _main ...

Linking two object files with a common symbol

If i have two object files both defining a symbol (function) "foobar". Is it possible to tell the linker to obey the obj file order i give in the command line call and always take the symbol from first file and never the later one? AFAIK the "weak" pragma works only on shared libraries but not on object files. Please answer for all th...

What is the problem with linking of Pthreads libraries to .c file in MSVC++6?

Hi Could someone please help me to compile my .c file with MSVC++6 in windows xp? From this morning, I am trying to compile it but it give me the following errors: --------------------Configuration: server_th - Win32 Debug-------------------- Linking... server_thread.obj : error LNK2001: unresolved external symbol _ThreadMain Debug/se...

CUDA: Getting linking error only in device emulation mode

I am compiling a dll which goes just fine unless I use the -deviceemu mode. In this case I get several of the following linking errors: CUDAKernel_ColourHist.obj : error LNK2019: unresolved external symbol ___cudaMutexOperation@4 referenced in function ___uAtomicAdd 1>CUDAKernel_1.obj : error LNK2001: unresolved ext...

Compiling a static lib inside a exe

I have a dll and an exe, both of which I have the sources to. For the DLL I have compiled completely statically and therefore, I would assume that the the .lib is also static. However, when I include that lib in my C++ VC++ 2008 project under Linker > Input > Additional Dependencies . I set the compile mode to /MT (multi-threaded) for t...

What is the difference between LD_LIBRARY_PATH and -L at link time?

I'm having problems with LD_LIBRARY_PATH at link time (this question has nothing to do with run time). The link line looks like this when I run make (this is a Linux system using g++ version 4.1.x): g++ a.o b.o c.o -o myapp \ -L/long/path/to/libs/ \ -L/another/long/path/ \ -labc -ldef -lghi The -l options reference shared librarie...