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
9 answers

How to solve error LNK2019

I am sending a simple email in C++. I downloaded a sample C++ program from the below link. http://cboard.cprogramming.com/cplusplus-programming/125655-sending-simple-email-cplusplus.html The sample program seems to hit the following error when it…
user1
  • 687
  • 7
  • 13
  • 24
6
votes
2 answers

Duplicated memory management symbols in libc.so and ld-linux.so

Some preamble It seems that malloc, calloc, realloc and free are all replicated in ld-linux.so and libc.so . As I understand it, that is done by the dynamic loader to take care of memory management within ld-linux.so before libc.so is loaded and…
fons
  • 4,905
  • 4
  • 29
  • 49
6
votes
3 answers

creating global variables causes linker error

I have an MFC application AVT_testapp, and in the header file (AVT_testappDlg.h) I am trying to create a variable outside of all functions, classes, etc. in order to make it global. Whenever I try to do this though (say I try int x = 7), I get the…
xcdemon05
  • 1,372
  • 5
  • 25
  • 49
6
votes
2 answers

go + cgo and linking

i want to use the following c as Go's cgo: #include main() { XScreenSaverInfo *info = XScreenSaverAllocInfo(); Display *display = XOpenDisplay(0); XScreenSaverQueryInfo(display, DefaultRootWindow(display),…
brian_j
  • 61
  • 1
  • 5
6
votes
2 answers

Will a copied executable run on a new machine without the libraries

If I compile a C++ program on a linux box that has many libraries installed (Boost for example) and then copy that executable to a new linux box without those libraries, will the executable still run properly?
Josh Brittain
  • 2,162
  • 7
  • 31
  • 54
6
votes
1 answer

Install OpenCV and compile C program using GCC

As part of a bigger project I am working on, I need to use the OpenCV library on a C program. I installed OpenCV and opencv-devel using yum in Fedora 17 32-bit. I instructed the preprocessor to import opencv/cv.h and opencv/highgui.h, as the…
someone
  • 361
  • 2
  • 3
  • 13
6
votes
1 answer

error LNK2005: _exit already defined in msvcrt.lib(MSVCR90.dll)_LIBCMTD.lib?

Hi i am using libjpeg lib and libpng lib in my application... when i compile my application in debug mode..it is working fine... But when I compile my application in release mode i am getting following link error... Error 41 error LNK2005:…
kai chen
  • 358
  • 4
  • 19
6
votes
1 answer

GNU Linker Map File Giving Unexpected Load Addresses

I'm working on an embedded program where I have a custom linker script. The program works, but I have noticed that there is possibly something amiss with how the linker is placing a couple of sections in memory. Here are the relevant parts of the…
Adam Goodwin
  • 3,951
  • 5
  • 28
  • 33
6
votes
2 answers

Linking to boost::program_options does not work properly

The following library files exist: cls /usr/local/Cellar/boost/1.51.0/lib $ ls libboost_program* libboost_program_options-mt.a libboost_program_options-mt.dylib I include the following header with #include : cls…
clstaudt
  • 21,436
  • 45
  • 156
  • 239
6
votes
1 answer

D Build Process

How does the process of building (compiling and linking) source code in D differ from C/C++ especially with regards to inline functions, D's module system (instead of headers) and build tools. How are template instantiations reused in D?
Nordlöw
  • 11,838
  • 10
  • 52
  • 99
6
votes
1 answer

Is there a linker script directive that allows me to move my stack start address?

I'm trying to change the start location of my stack using a linker script on x86_64. I was able to move my executable start address using this: PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x200000)); . =…
6
votes
2 answers

Member at n is not an ELF object

I am trying to build a library (Tesseract OCR) for Android. It seems to compile just fine, and I get a bunch of static libraries, but it fails during the linking phase. The command is: libtool: link:…
squidpickles
  • 1,737
  • 19
  • 27
6
votes
2 answers

Linking fails using mpicc on C++ program

I'm running Ubuntu 11.04 64-bit. I have installed OpenMPI. I'm trying to build the following code, which is a snippet from a test problem from the book "Using MPI" by Gropp/Lusk/Skjellum: #include #include "mpi.h" int main(int argc, char…
synaptik
  • 8,971
  • 16
  • 71
  • 98
6
votes
2 answers

slam package install fails with make error

I'm trying to install the slam package, but it seems to fail on my system. I'm running ubuntu 12.04. I thought it was a missing library or something so I installed a few that match liblas, but no dice. * installing *source* package ‘slam’ ... **…
Brandon Bertelsen
  • 43,807
  • 34
  • 160
  • 255
6
votes
1 answer

Can I include/import a single function from a library in C++

I only need to use the iequals case-insensitive string comparison function from the BOOST library. I am using #include to import it. Is there any way that I could only import the iequals function by itself? The reason I…
Dr3vvn45ty
  • 63
  • 1
  • 5