linker

How do I force cmake to link MSVCR.dll statically in windows XP?

Currently it's linking it dynamically,causing much trouble for me(missing msvcr80.dll). How should I instruct cmake to link it statically? ...

Link Error : xxx is already defined in *****.LIB :: What exactly is wrong?

Problem: I'm trying to use a library named DCMTK which used some other external libraries ( zlib, libtiff, libpng, libxml2, libiconv ). I've downloaded these external libraries (*.LIB & *.h files ) from the same website. Now, when I compile the DCMTK library I'm getting link errors (793 errors) like this: Error 2 error LNK2005: __e...

g++: how to specify preference of library path?

I'm compiling a c++ program using g++ and ld. I have a .so library I want to be used during linking. However, a library of the same name exists in /usr/local/lib, and ld is choosing that library over the one I'm directly specifying. How can I fix this? For the examples below, my library file is /my/dir/libfoo.so.0. Things I've tried tha...

How do I solve an unresolved external when using C++ Builder packages?

I'm experimenting with reconfiguring my application to make heaving use of packages. Both I and another developer running a similar experiment are running into a bit of trouble when linking using several different packages. We're probably both doing something wrong, but goodness knows what :) The situation is this: The first package...

Makefile can not find boost libraries installed by macports

I just installed boost 1.42.0 from macports using sudo port install boost. Everything worked fine. Now I have a project that I'm trying to build using a makefile. Everything builds fine until it comes to the file that needs the boost library. It says: src/graph.h:20:42: error: boost/graph/adjacency_list.hpp: No such file or directo...

link to a different libc file

I want to supply the shared libs along with my program rather than using the target system's due to version differences: ldd says my program uses these shared libs: linux-gate.so.1 => (0xf7ef0000)(made by kernel) libc.so.6 => /lib32/libc.so.6 (0xf7d88000)(libc-2.7.so) /lib/ld-linux.so.2 (0xf7ef1000)(ld-2.7.so) I have successfully lin...

error LNK2005: xxx already defined in MSVCRT.lib(MSVCR100.dll) C:\something\LIBCMT.lib(setlocal.obj)

Hello, I'm using DCMTK library for reading Dicom files (Image format used in medical image processing.) I'm having a problem in compiling this DCMTK source code. DCMTK uses some additional external libraries (zlib, tiff, libpng, libxml2, libiconv). I know that all libraries should be generated with same Code Generation Options. I've do...

How to deal with recursive dependencies between static libraries using the binutils linker?

I'm porting an existing system from Windows to Linux. The build is structured with multiple static libraries. I ran into a linking error where a symbol (defined in libA) could not be found in an object from libB. The linker line looked like g++ test_obj.o -lA -lB -o test The problem of course being that by the time the linker finds it ...

How to Embed/Link binary data into a C++ DLL

So I have a Visual Studio 2008 project which has a large amount of binary data that it is currently referencing. I would like to package the binary data much like you can do with C# by adding it as a "resource" and compiling it as a DLL. Lets say all my data has an extension of ".data" and is currently being read from the visual studio...

Why does C++ linking use virtually no CPU? (updated)

On a native C++ project, linking right now can take a minute or two, yet during this time CPU drops from 100% during compilation to virtually zero. Does this mean linking is primarily a disk activity? If so, is this the main area an SSD would make big changes? But, why aren't all my OBJ files (or as many as possible) kept in RAM after co...

Problem setting up Direct X for C++

I've downloaded Direct X SDK from the microsoft website but when I try to compile my code i'm getting this error: Error 1 error LNK2019: unresolved external symbol _Direct3DCreate9@4 referenced in function "void __cdecl initD3D(struct HWND__ *)" (?initD3D@@YAXPAUHWND__@@@Z) C:\Users\Josh\Desktop\Tutorial\Tutorial\Tutorial.obj ...

GCC: Simple inheritance test fails

I'm building an open source 2D game engine called YoghurtGum. Right now I'm working on the Android port, using the NDK provided by Google. I was going mad because of the errors I was getting in my application, so I made a simple test program: class Base { public: Base() { } virtual ~Base() { } }; // class Base class Vehic...

In function `_start': init.c:(.text+0x30): undefined reference to `main'

Hi Guys, I'm working on a C project with around 30 source files (.c). I'm building this project on a 32 bit micro-controller(i.MX515) running on Ubuntu using GNU tools. The compilation phase completes successfully, however when the linking process starts I get this error (For full error at the end of the quesiton): In function `...

How can I change the filename of a shared library after building a program that depends on it?

I have a program that depends on a shared library it expects to find deep inside a directory structure. I'd like to move that shared library out and into a better place. On OS X, this can be done with install_name_tool. I'm unable to find an equivalent for Linux. For reference, readelf -d myprogram spits out the following paraphrased ou...

Test for external undefined references in Linux

Is there a built in linux utility that I can use to test a newly compiled shared library for external undefined references? Gcc seems to be intelligent enough to check for undefined symbols in my own binary, but if the symbol is a reference to another library gcc does not check at link time. Instead I only get the message when I try to...

How to include all objects of an archive in a shared object?

When compiling our project, we create several archives (static libraries), say liby.a and libz.a that each contains an object file defining a function y_function() and z_function(). Then, these archives are joined in a shared object, say libyz.so, that is one of our main distributable target. g++ -fPIC -c -o y.o y.cpp ar cr liby.a y.o...

Link error (LNK2019) when including other projects in Visual Studio 2005

I am trying to work with several projects on visual studio 2005. I have one project that depends on two others. I have included those two project in the first project solution, and set the dependencies correctly. I get this error when linking the project: 1>server_controller.obj : error LNK2019: unresolved external symbol "public: __t...

Visual C++ 2008: Finding the cause of slow link times

I have a legacy C++ project that takes an annoyingly long time to build (several minutes, even for small incremental changes), and I found most of the time was spent linking. The project is already using precompiled headers and incremental compilation. I have enabled the "/time" command line parameter in the hope I would get more detail...

ASP.NET MVC 2 relative paths for scripts and styles

Hi, having this really silly problem in ASP.NET MVC 2 with .NET 4. I need to test other pages using localhost, but sometimes I need to show the page to some else on another computer and so need to path out to my machine. In doing so, I need to use relative paths for my and tags. When I test through VS, I use relative path: <script sr...

C++: Constructor/destructor unresolved when not inline?

In a plugin-based C++ project, I have a TmpClass that is used to exchange data between the main application and the plugins. Therefore the respective TmpClass.h is included in the abstract plugin interface class that is included by the main application project, and implemented by each plugin. As the plugins work on STL vectors of TmpCla...