linker

Are llvm-gcc and clang binary compatible with gcc? - particularly mingw gcc on Windows.

If I build a static library with llvm-gcc, then link it with a program compiled using mingw gcc, will the result work? The same for other combinations of llvm-gcc, clang and normal gcc. I'm interested in how this works out on Linux (using normal non-mingw gcc, of course) and other platforms as well, but the emphasis is on Windows. I'm ...

C++: How to link a library, located in my project folder?

Hi, I'm using Linux and Eclipse. I want to use a library (Box2D). I have the lib-file "libBox2D.so.2.1.0". I put it in a self-made lib folder in my project folder (also the working directory for the executable). I added -lBox2D to the linker command-line arguments. (This means I added "Box2D" as library in the Eclipse GUI). But when I ...

Regular Expressions in OCaml

Hello, I want to use regexps in OCaml and it seems that Str module provides these functionalities. So I tried with a simple program: open Str let regx = regexp "." but it gives me the following error File "lol.ml", line 1, characters 0-1: Error: Error while linking lol.cmo: Reference to undefined global `Str' As if module i...

GNU ld cannot find library which is there

The packages I'm toying with here are rather unknown, but nevertheless the problem is rather generic. Basically, I'm trying to compile Python module (called rql) with C++ extension. The extension uses external framework called gecode, which contains several libraries. I compiled gecode and installed locally. Now, let the output speak for...

Why does the order of linked object file with $L directive matter?

I use statically linked sqlite database and in order to compile every next version I sometimes have to do minor changes in the list of object files used. But sometimes the changes I have to make puzzles me. For example prior to version 3_6_10 this order {$L 'Objs\is.OBJ'} {$L 'Objs\mbisspc.OBJ'} was ok, but starting 3_6_12 the linker...

A Question About Linking/Loading and A Simulator

I have designed a MIPS I simulator using Verilator which allows me to wrap verilog code into c++. I am attempting to run a c++ program on my processor but I've reached some problems. My goal is to: write a test program in c++ compile this program using a cross compiler g++ (mips-linux) take generated ELF file and disassemble it using...

Duplicate symbol issues

During a refactor of an iOS project, I ran into this bear of a bug. During the linking phase, I get this message: ld: duplicate symbol _OBJC_IVAR_$_TinCanViewController.currentViewController in /path/to/TinCanViewController-E98A666B7AF2673A.o and /path/to/TinCanViewController-E98A666B7AF2673A.o As far as I can tell, it looks like i...

Linking with multiple versions of a library

Hi, I have an application that statically links with version X of a library, libfoo, from thirdparty vendor, VENDOR1. It also links with a dynamic (shared) library, libbar, from a different thirdparty vendor, VENDOR2, that statically links version Y of libfoo from VENDOR1. So libbar.so contains version Y of libfoo.a and my executable co...

Can you force unreferenced code to be linked in from a static library?

Here's the scenario - I have created a custom NSView subclass, and the implementation is in a static library. The class is never referenced from the final executable, only from the Interface Builder XML file. Since it's not referenced, it doesn't get included at link time, and as a result the class can't be found at runtime. Is there an...

static linking log4c-1.2.1 with Fedora 12 and Eclipse 3.5.1

Hello All, We are building a project that requires log4c to be linked in the static mode, the following is part of the linker error that is being generated. /usr/local/lib/liblog4c.a(domnode-expat.o): In function `sd_domnode_read': /log4c-1.2.1/src/sd/domnode-expat.c:316: undefined reference to `XML_ParserCreate' /log4c-1.2.1/src/sd/do...

Linking after using f2c

I used f2c to translate a huge Fortran subroutine into C. The header says the following: /* fourier.f -- translated by f2c (version 20090411). You must link the resulting object file with libf2c: on Microsoft Windows system, link with libf2c.lib; on Linux or Unix systems, link with .../path/to/libf2c.a -lm or, if you inst...

Including extra libraries on the link line

When linking an executable, if it does not make reference to any of the symbols in one of the DLLs on the link line, will it still depend on that DLL at runtime? To make the question concrete, suppose I am building an application from Visual Studio project foo. Under Project Properties > Linker > Input > Additional Dependencies I have ...

fftw3 on windows 64-bit

I would like to use FFTW3 on Windows-64 bit. I follow the instructions on FFTW website: download the package, unzip, run lib.exe to create .lib "import libraries". After doing so, I build my application (which runs just fine using FFTW3 dlls 32-bit) and I get the following errors: 1>pyramidTransform.obj : error LNK2019: unresolved...

How to get all duplicate symbol linker errors at once?

Hi, I am building a C++ project in XCode which uses two libraries. Say for e.g libX.a and libY.a. There are some function definitions common on libX.a and libY.a for which I get duplicate symbol linker error. This is fine, but I get only one error at a time. Once I fix the error, I'll get the next duplicate symbol error and this proces...

What's the difference between libs under Debug/ and Release/ directory in C?

When I link to the one under Release/ ,got a fatal error: LINK : fatal error LNK1146: no argument specified with option '/machine:' Then I tried to link to the .lib under Debug/ and this time it works. But what can be different? ...

How to get around "multiple defined symbols" in linking with gcc.

I am using an older system that has gcc 2.95.3, I have to link in two objects that although they have nothing to do with each other, they each have similarly named methods. I can't rename either of them, but I would hope there is a way to build them as to not have the linker complain. The methods it is complaining about are each intern...

What is inside .lib file of Static library, Statically linked dynamic library and dynamically linked dynamic library?

What is inside .lib file of Static library, Statically linked dynamic library and dynamically linked dynamic library? How think there is no need for a .lib file in dynamically linked dynamic library and also that in static linking, the .lib file is nothing but a .obj file with all the methods. Is it correct? ...

Ways of Linking/Referencing XML nodes

Alright this question might sound a little bit stupid but I don't know where to start so I'll simply ask: I need a way to link or reference XML nodes among each other. So I started interviewing google and did find a few examples...yet I am not quite satisfied with the solutions i found. So i was wondering if there is a commonly accepted...

How can adding a function call cause other symbols to become undefined when linking?

Hey Guys, I'm hoping someone will be able to help troubleshoot what I think is a linker script issue. I'm encountering a strange problem after adding a call to a new function. Without the function call, my object files link correctly, however, with the new function call added, I get an undefined reference to a symbol from another object...

Cross Compiler Binary Execute Error

I just built a cross compiler using crosstools "mips-unknown-linux-gnu-gcc" and I compiled a hello world program. The compilation went fine using the command: "mips-unknown-linux-gnu-g++ hello.cpp -o hello" but when I run the command "./hello" I get the following error: babbage-dasnyder 50% mips-unknown-linux-gnu-g++ hello.cpp -o hello...