Questions tagged [linker]

The linker is part of the toolchain for producing executables from source code written in compiled programming languages. It takes compiled object code in multiple files and produces a single, "linked", executable file from them.

Separately-compiled programming languages such as C and C++ rely on a linker to turn one or more object files and libraries into an executable. The linker resolves undefined symbol references in object files by linking them to symbol definitions in other object files and libraries. The linker also arranges variables and functions to assign them addresses in the final executable,

On Unix-like operating systems the linker is typically named ld and is often invoked automatically by the compiler as the last step in the compilation process.

Books about linkers:

13907 questions
6
votes
1 answer

Linker Error when building Xcode project using external library

I am attempting to build a very simple command line application, in Xcode, that will print out basic information about MXF video files. In order to do this I need to use the libmxf, libbmx, and libbmx libraries available for download here:…
Ned W.
  • 163
  • 1
  • 6
6
votes
3 answers

GCC / Linux: adding a static library to a .so?

I've a program that implements a plugin system by dynamically loading a function from some plugin_name.so (as usual). But in turn I've a static "helper" library (lets call it helper.a) whose functions are used both from the main program and the main…
royconejo
  • 2,213
  • 3
  • 24
  • 29
6
votes
1 answer

Linking to multiple libraries, one of which wraps a set of system calls

So this is the scenario that I'm looking at: I have 3 libraries - A, B and C. Library A implements function foo() and exposes it as an API. Function foo() calls the POSIX write() call to write some data. Library B writes a wrapper to the write()…
crazyg33k
  • 165
  • 9
6
votes
5 answers

LNK 2001 unresolved external symbol _mainCRTStartup MASM

I'm learning Assembly at my university, and we were given a CD with MASM 615 on it, and we're using the Irvine32 include library. Everything works fine with it on the school computer, but when I try to compile and run the same code on my home…
6
votes
1 answer

Which linker is used by gcc?

How to determine which linker is used by my gcc? For example I have 3 linkers: 2 in one directory, same place as for gcc and another one linker in another directory.
Laser
  • 6,652
  • 8
  • 54
  • 85
6
votes
4 answers

Linking against library in release and .exe in debug crashes in Visual studio

I'm using Visual C++ 2008 SP1. I have an app that is compiled in debug mode, but links against a library in release mode. I'm getting a crash at the start-up of the application. To make the problem smaller, I created a simple solution with 2…
Gustavo Muenz
  • 9,278
  • 7
  • 40
  • 42
6
votes
3 answers

Identical build on different systems

I have 3 build machines. One running on windows 2000, one with XP SP3 and one with 64bit Windows Server 2008. And I have a native C++ project to build (I'm building with visual studio 2005 SP1). My goal is to build "exactly" the same dll's using…
ppiotrowicz
  • 4,464
  • 3
  • 32
  • 46
6
votes
1 answer

How to smartly detect undefined symbols when linking a plugin on GNU/Linux?

I have a program foo that can load plugins via dlopen(). I'm writing one such plugin foobar that interfaces to functionality provided by a third-party library libfoo. On Linux, I'm building foobar like this: gcc -fpic -c -o foobar.o foobar.c gcc…
Peter Eisentraut
  • 35,221
  • 12
  • 85
  • 90
6
votes
4 answers

What every C++ developer should know about linking

The problem Information on how linking works in detail are scarce. Also IDEs hide the details of compilation which is a real pain when you have some linking related problem with your project. Usually C++ books tell me that C++ code --> preprocessed…
Klaufir
  • 751
  • 1
  • 7
  • 10
6
votes
3 answers

C++ linker problems with static method

I'm writing a Vector3D class that calls a static method on a VectorMath class to perform a calculation. When I compile, I get this: bash-3.1$ g++ VectorMath.cpp Vector3D.cpp /tmp/cc5cAPia.o: In function `main': Vector3D.cpp:(.text+0x4f7): undefined…
Lee
6
votes
1 answer

What standard library function does libc.a contain?

When using gcc under Linux, one does not need to add command-line options to use standard library functions like printf. In book An Introduction to GCC, it explains "The C standard library itself is stored in ‘/usr/lib/libc.a’ and contains functions…
WiSaGaN
  • 46,887
  • 10
  • 54
  • 88
6
votes
2 answers

How can I convert a VSTS .lib to a MinGW .a?

I have a static library compiled with Visual Studio and I want to link to it from MinGW. I tried changing the suffix but I get a bunch of warnings like: Warning: .drectve /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MSVCRT"…
chacham15
  • 13,719
  • 26
  • 104
  • 207
6
votes
2 answers

Android: Cannot load library (94 missing essential tables)

I'm developing an Android application that uses a huge native library. Some customers are complaining about a crash at startup, one of them gave us his logcat dump: 07-19 10:55:15.139 E/AndroidRuntime(16539)FATAL EXCEPTION: AsyncTask #3 07-19…
spacifici
  • 2,186
  • 2
  • 16
  • 28
6
votes
6 answers

Override a function call in C from the same compilation unit

I am trying to Override a function call in C, but I am facing a problem when the function is used in the same compilation unit. In the code below, I am trying to replace the function get_resolution(), but I am able to achieve it only if done in…
vijairaj
  • 310
  • 3
  • 10
6
votes
1 answer

Why doesn't GCJ find the classes from my imported packages?

I want to compile a small Java application to a Windows executable. The application is very small, only a single main class, but it uses Apache POI. When I compile it, everything works fine, as long as I put the POI Jar into the class path…
Daniel Rikowski
  • 71,375
  • 57
  • 251
  • 329