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
5
votes
3 answers

Why do I get a multiple definition error while linking?

I use these two files here and here. I created a class in two separate files: modul1.h #ifndef MODUL1_H #define MODUL1_H #include #include #include "easylogger.h" class Modul1 { public: Modul1(std::string name); …
Burkhard
  • 14,596
  • 22
  • 87
  • 108
5
votes
3 answers

is it possible to create an object file from other object files in gcc?

I was trying to do something like this in a makefile: program.exe: ui.o main.o gcc ......etc ui.o: window1.o window2.o gcc -c window1.o window2.o -o ui.o #this doesn't want to work window1.o: window1.c window1.h window1_events.c…
Carson Myers
  • 37,678
  • 39
  • 126
  • 176
5
votes
4 answers

literal constant vs variable in math library

So, I know that in C you need to link the code to the math library, libm, to be able to use its functions. Today, while I was trying to demonstrate this to a friend, and explain why you need to do this, I came across the following situation that I…
mmirzadeh
  • 6,893
  • 8
  • 36
  • 47
5
votes
2 answers

Is there a way to use devenv.exe on the command line to link-only a project instead of full-build a project?

Is there a way to use devenv.exe on the command line to link-only a project instead of full-build a project? devenv.exe /? provides the below commands, none of which appear able to link-only a project instead of full-build a project. /Build /Clean…
Neil Justice
  • 1,325
  • 2
  • 12
  • 25
5
votes
2 answers

Why do I get a missing dll error after linking with a .lib?

I am working on this Windows program from 1999. I was unable to build it in Visual Studio as it kept giving me linker errors about missing symbols. Then my collegue told me to try taking .lib files from original project and try to specify them as…
bodacydo
  • 75,521
  • 93
  • 229
  • 319
5
votes
2 answers

how to suppress "linker file unused" when compiling

part of my makefile looks like this ... ifdef vis flg += -framework GLUT -framework OpenGL -Dvis obj += camfun.o glfuns.o endif ... all: driver.cpp header.h $(obj) $(cc) -o $(exe) driver.cpp $(obj) $(flg) $(lib) funs.o: header.h funs.cpp …
drjrm3
  • 4,474
  • 10
  • 53
  • 91
5
votes
1 answer

How to distinguish between relocatable and non relocatable symbols inside .data.rel section

I'm trying to create a simple linker for a barebone ARM application. Currently the loader, that loads the module, will simply add the offset to all records inside the .got and .data.rel sections. This works fine in .got, and for all symbols that…
SztupY
  • 10,291
  • 8
  • 64
  • 87
5
votes
1 answer

Duplicate symbol error when linking multiple static libraries.

There are a fair number of related questions out there already, but I'm just not getting this resolved. I'm building an application that includes two separate static libraries: RestKit and another that's on NDA. When I build, I'm getting a Apple…
geraldWilliam
  • 4,123
  • 1
  • 23
  • 35
5
votes
8 answers

C++: Compiler and Linker functionality

I want to understand exactly which part of a program compiler looks at and which the linker looks at. So I wrote the following code: #include using namespace std; #include class Test { private: int i; public: Test(int…
madu
  • 5,232
  • 14
  • 56
  • 96
5
votes
1 answer

Eclipse 3.7.0 Indigo CDT, symbol vector could not be resolved

This might very well be similar if not the same to question that has already been asked. I am running eclipse CDT on ubuntu machine. I get false compilation error saying 'vector' symbol could not be resolved. I have tried to fix it by manually…
Ha Sh
  • 724
  • 5
  • 26
5
votes
1 answer

Why is SenTestingKit causing my app to crash?

I've created a map-based app for the iPhone, and recently submitted it to the store. I had no trouble running the app on the device or simulator. However, the store rejected it because it crashed on launch. The crash logs complain that the…
Joel Koroniak
  • 63
  • 1
  • 6
5
votes
2 answers

How to instruct the compiler to generate an alias for a virtual function?

See this question for the background. Basically, I have the following definition of a class class MyClass { virtual int foo4(double, int); }; Is there a way to instruct the compiler to generate two symbols that would resolve to foo4? That is,…
p12
  • 1,161
  • 8
  • 23
5
votes
3 answers

expanded command line too long

I face with a problem in linking phase, while working with MSVC9 . It says: NMAKE : fatal error U1095: expanded command line link.exe . . . too long
5
votes
1 answer

Using LLVM bytecode for libraries (instead of native object files)

What are the implications on portability (calling convention: does it really matter at an LLVM level when only calling into C or OS library functions) link time optimizations I would like to compile a toy language with LLVM, due to all the hard…
rubenvb
  • 74,642
  • 33
  • 187
  • 332
5
votes
2 answers

Undefined reference when dynamically linking with gcc in cygwin

(This is gcc 3.3.1 (long story -- blame NIST) on Cygwin.) I have compiled some source files with gcc -c -fPIC ... to get .o files. Then I did: $ gcc -shared -o foo.dll foo.o bar.o But when I go to use it: $ gcc -o usefoo.exe usefoo.o -L. -lfoo …
QuantumMechanic
  • 13,795
  • 4
  • 45
  • 66
1 2 3
99
100