linker

g++ partial linking instead of archives?

I'm pretty new to the C++ build flow, and I'm thinking of switching to use partial linking for my libraries instead of creating ar archives. I'm hoping to reduce link time in an inevitable final compilation step that I have, and I figure partial linking some libraries once could save me time over linking everything in that final step. I...

How to make weak linking work with GCC?

There seem to be 3 ways of telling GCC to weak link a symbol: __attribute__((weak_import)) __attribute__((weak)) #pragma weak symbol_name None of these work for me: #pragma weak asdf extern void asdf(void) __attribute__((weak_import, weak)); ... { if(asdf != NULL) asdf(); } I always get a link error like this: Undefined symbo...

error when import zlib in iphone sdk

I have included in my iphone application and the source code I was mocking up the sample code of Molecules provided by Brad Larson, however, when I build the project, it returns the error as below. Can anyone point out for me whether this is a library linking problem or am I missing something else? "_deflate", referenced from: -[NSDat...

How can I find out which library is home to a given object?

I'm programming in FORTRAN and C on an SGI running Irix 6.5, but this should be applicable to all Unix-like systems. How do I find which library I need to link to my program when I get an "unresolved text symbol" link error? Here's an example of what I'm seeing from the linker: ld32: ERROR 33 Unresolved text symbol "ortho2_" -- first...

g++ undefined reference to typeinfo

I just ran across the following error (and found the solution online, but it's not present in Stack Overflow): (.gnu.linkonce.[stuff]): undefined reference to [method] [object file]:(.gnu.linkonce.[stuff]): undefined reference to `typeinfo for [classname]' Why might one get one of these "undefined reference to typeinfo" lin...

C++ Problem : "Error external 'C::C()' referenced from C:\C++\CRP.OBJ" ....

Hi, I'm trying to get this: //C.h #ifndef C_H #define C_H #include "c.h" class C { public: C(); int function(int, int); }; #endif which is defined in this: //c.cpp #include "c.h" C::C() { } int C::function(int a, int b) { return a * b; } to work in this: //crp.cpp #include <iostream> #include "c.h" void main(vo...

What do 'statically linked' and 'dynamically linked' mean?

I often hear the terms 'statically linked' and 'dynamically linked', often in reference to code written in C(++|#) but I don't know much of anything about either, what are they, what exactly are they talking about, and what are they linking? ...

C++ Linking Errors: Undefined symbols using a templated class.

I'm getting some really wierd linking errors from a class I wrote. I am completely unable to find anything that will describe what is happening. Visual Studio (Windows XP) players.obj : error LNK2019: unresolved external symbol "public: __thiscall TreeNode::TreeNode(void)" (??0?$TreeNode@VPlayer@@@@QAE@XZ) referenced in function "p...

Static linking advantages

I recently read a question on here about static and dynamic linking, which reminded me of some questions I've had about it. From that post, I can see what the technical difference is (including object file contents directly instead of merely pointing to it), but I'd like to know a bit more about the pros/cons of doing so. A while ago,...

Why does every build change the exe-file?

Building the same project (without any changes) produces binary different exe-files: some small regions of them are different. Empty project, version information (and auto-increment on every build) is turned off. Why it happens? And is it possible to make delphi produce binary equal files for the same projects? ...

Good resources concerning linking process in compilation

Hi everyone I've been coding for some time, and I always thought the linking phase of compilation was pretty straight forward, but recently I had to add a plugin system to an app, and I ran into quite a few compilation and runtime problems, due to my complete lack of knowledge on the matter. I've now got it working fine and learned a lo...

What is __gxx_personality_v0 for?

This is a second-hand question from an OS development site, but it made me curious since I couldn't find a decent explanation anywhere. When compiling and linking a free-standing C++ program using gcc, sometimes a linker error like this occurs: out/kernel.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0' This is appar...

How do you link two arrays?

I'm in a basic programming class, and everything is done in pseudo code. My question is this: How do you link two arrays? I have a single-dimensional array that lists students names, and I have a two-dimensional array that lists the top eight scores of each student...this is all fine and dandy, but now I need to sort the arrays by th...

Hide symbol(s) in Shared Object from LD

I have two third-party libraries occasionally having the same symbol name exported. When the executable is loaded, ld usually picks the wrong one and I getting crash as a result. I cannot do too much about the content of these libraries, so may be there is a way to instruct ld how to find the proper imlementation ? OS - Solaris 10, my p...

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: g++ -w (..lots of .o files/include directories/etc..) \ -L/usr/lib -l...

How the basic link process works for ELF and PE

I've always been confused about how the linker works, and it's a difficult subject to search for. To demonstrate my question and to provide a framework for an answer, I'll put down what I know (or think I know) so far. I may be very wrong. :) First, each .cpp file is built into an intermediate file (.o for Posix/ELF and .obj for Win/PE...

Can you statically compile a cygwin application?

Does cygwin allow a statically compiled binary? This would prevent the need for cygwin1.dll being on the PATH of target machines. ...

error LNK2005: _DllMain@12 already defined in MSVCRT.lib

I am getting this linker error. mfcs80.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MSVCRT.lib(dllmain.obj) Please tell me the correct way of eliminating this bug. I read solution on microsoft support site about this bug but it didnt helped much. I am using VS 2005 with Platform SDK ...

Visual Studio 2008 C++ Problems

I'm trying to write a program to calculate the quadratic formula. When I run it, I get 2 error messages: error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup fatal error LNK1120: 1 unresolved externals this is after I changed the last line of code from ...: << danswer1, danswer2 >> to <<...

How to rename exe file

Say I've got a generic vertical market application and I want to package it as two separate programs aaa.exe and bbb.exe. Is there any way to use the Delphi linker to create an EXE/DLL file that doesn't have the same name as the DPR? I can't just rename the file because I get this error bbb.exe - Unable to to locate component ...