linker

Missing A Detail About Boost (.lib files)

Where do I find the lib files for linking my program when using some Boost libraries? Decided to try its threading functionality but I am getting Error 6 fatal error LNK1104: cannot open file 'libboost_thread-vc90-mt-gd-1_42.lib' InterviewPractice after I include Error 6 fatal error LNK1104: cannot open file 'libboo...

Visual C++ overrides/mock objects for unit testing?

When I'm running unit tests, I want to be able to "stub out" or create a mock object, but I'm running into DLL Hell. For example: There are two DLL libraries built: A.dll and B.dll -- Classes in A.dll have calls to classes in B.dll so when A.dll was built, the link line was using B.lib for the defintions. My test driver (Foo.exe) is te...

glui /usr/bin/ld: cannot find -lXmu

Hello: I have downloaded the latest GLUI source code and now I am trying to compile it. When I do so, I get the following error: g++ -O0 -Wall -pedantic -I./ -I./include -I/usr/X11R6/include -o bin/example1 example/example1.cpp -L./lib -lglui -L/usr/X11R6/lib/libXdmcp.a -lglut -lGLU -lGL -lXmu -lXext -lX11 -lXi -lm /usr/bin/ld: cannot...

How to catch unintentional function interpositioning?

Reading through my book Expert C Programming, I came across the chapter on function interpositioning and how it can lead to some serious hard to find bugs if done unintentionally. The example given in the book is the following: my_source.c mktemp() { ... } main() { mktemp(); getwd(); } libc mktemp(){ ... } getwd(){ ...; mktemp...

How do I make a Mach-O binary from an object file?

I have an object file, which I'd like to make into a Mach-O binary(I'm on Mac OS 10.6). Running ld -e _main source.o /usr/lib/libc.dylib produces the following output: ld: symbol dyld_stub_binding_helper not defined (usually in crt1.o/dylib1.o/bundle1.o) for inferred architecture x86_64 How can I reference libc using ld? ...

python c extension, problems with dlopen on mac os

I've taken a library that is distributed as a binary lib (.a) and header, written some c++ code against it, and want to wrap the results up in a python module. I've done this here. The problem is that when importing this module on Mac OSX (I've tried 10.5 and 10.6), I get the following error: dlopen(/Library/Python/2.5/site-packages/...

gcc does not resolve extern global variables, with or without -c option

Hello everyone! So i have this issue : i am declaring some extern global variables in my C program. If I don't use the -c option for gcc, i get undefined references errors. But with that -c option, the linking is not done, which means that i don't have an executable generated. So how do I solve this? Here is my makefile (written thanks...

Linking LAPACK/BLAS libraries

Background: I am working on a project written in a mix of C and Fortran 77 and now need to link the LAPACK/BLAS libraries to the project (all in a Linux environment). The LAPACK in question is version 3.2.1 (including BLAS) from netlib.org. The libraries were compiled using the top level Makefile (make lapacklib and make blaslib). Probl...

XCode linking error when targeting armv7.

I've already spent countless hours puzzling over this, utilizing Google searches and other Stack Overflow questions to no avail. I have an iPhone/iPad universal application, which seems to compile fine when the target is armv6. However, when the device is iPad, I get this warning: warning: building for SDK 'Device - iPhone OS 3.2' req...

Solaris linker verbosity options (ld -D tokens)

When linking with ld (SunOS 5.10, Sun Studio 12), what is the list of possible tokens that are accepted by ld -D? Neither man ld nor ld --help reveals the proper list. Namely, I need full information on the missing symbols (not just the demangled name of a C++ function). ...

Compile a shared library statically

I've got a shared library with some homemade functions, which I compile into my other programs, but I have to link the end program with all the libraries I have used to compile the static library. Here is an example: I have function foo in the library which requires a function from another library libbar.so. In my main program to use f...

Classes with the same name - is it restricted only within the same translation unit?

Let's just I had the following code: foo.h class Foo { // ... }; foo.cpp #include "foo.h" // Functions for class Foo defined here... Let's say that Foo are built into a static library foo.lib. Now let's say I have the following: foo2.h class Foo { // ... }; foo2.cpp #include "foo2.h" // Functions for class Foo define...

Oh no, not another Undefined Reference question!

Unfortunately yes. I have my shared library compiled, the linker doesn't complain about not finding it but still I get undefined reference error. Thinking that I might be doing something wrong I did a little research and found this nice, simple walkthrough: http://www.adp-gmbh.ch/cpp/gcc/create_lib.html which I've followed to the lett...

Why does my Visual C++ .exe project build create .lib and .exp files?

I have a solution consisting of 3 projects. One is a static library, and two are console-based .exe files that depend on and link against this library. Their settings seem to be identical. I build one of them: 1>------ Build started: Project: masksample, Configuration: Debug Win32 ------ 1>Compiling... 1>stdafx.cpp 1>Compiling....

xcode collect2: ld returned 1 exit status - how to resolve?

From what I have read this is supposed to be when the linker (not exactly sure how that works) can't find a symbol. the symbol in question is: SCNetworkReachabilityCreateWithAddress as can be seen from the full error message below. the thing is that the correct framework is added to my target. xcode recognises the symbol OK, i.e. ther...

Question about COFF Externs

The Microsoft PE / COFF SPEC (v8, section 5.4.4) says that when a symbol has: A storage class of IMAGE_SYM_CLASS_EXTERNAL And a section number of 0 (IMAGE_SYM_UNDEFINED) It's "value" field (in the symbol table) "indicates the size". This confuses me. In particular, I'm wondering "indicates the size of what?". Generally, IMAGE_SYM_C...

why compiling GLUT project in NetBeans with MinGW doesnt work.

Hello, I have this situation, I use Netbeans 6.8 with recommended MinGW+msys configuration, and compiling works. Now I have a project which is using glut, so I linked the libraries opengl32, glut32, glu32, gdi32, winmm, mingw32 in "project properties->build->linker->libraries", i manually selected all .lib files and the compilation works...

Unresolved external using C++Builder packages (with TForm-based classes)

I'm working with Borland C++Builder 6 and 2010, and am having this problem. However, the difference here is that i'm using a FORM compiled inside the package, so, take the example above, but in addition I'm including a form class, like TForm2: class TForm2 : public TForm { __published: // IDE-managed Components TButton *Button1;...

is it possible to load a shared library on a shared memory?

I have a server and a client written in C. I try to load a shared library in the server and then pass library function pointers to the client. This way I can change the library without have to compile the client. Because of every process has its own separate memory space, I wonder if it is possible to load a shared library on a shared m...

Visual Studio Solution: static or shared projects?

When a whole project (solution) consists of multiple subprojects (.vcproj), what is a preferable way to tie them: as static libraries or as shared libraries? Assuming that those subprojects are not used elsewhere, the shared libraries approach shouldn't decrease memory usage or load time. ...