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

Can I mix c and cpp files in a C++ project?

I have a project that had c files and cpp files mixed in it. The linker throws errors at me: undefined reference to After I rename all *.c files to *.cpp the errors vanish. So can't I mix those files or is this…
Bitterblue
  • 13,162
  • 17
  • 86
  • 124
6
votes
4 answers

not clear with the job of the linker

I'm using C language on windows. This question was previously part of What happens to identifiers in a program? . I broke it to reduce no. of questions. This is a standalone query (doesn't depend on the previous question) If there is nothing to link…
Alice
  • 471
  • 1
  • 5
  • 6
6
votes
4 answers

What happens to identifiers in a program?

I'm a novice programmer. I just wanted to see output at different phases compilation, assembling & linking. I don't know assembly language also. I wrote a simple program #include int humans = 9; int main() { int lions = 2; …
Alice
  • 471
  • 1
  • 5
  • 6
6
votes
2 answers

Forcing a symbol to the top of a ELF file

In our ELF files generated via GCC linker the top of the ELF file is always the version identifier of the executable code. This is achieved by creating version.c file and making the resulting object file the 1st linkable object in the link…
user2881914
  • 407
  • 1
  • 4
  • 9
6
votes
2 answers

How do I disable the generation of an import library?

I'm creating a COM DLL in Visual Studio. The linker generates an import library for the DLL. I don't need the import library. Is there any way to tell the linker not to generate it?
Roger Lipscombe
  • 89,048
  • 55
  • 235
  • 380
6
votes
1 answer

Building a Haskell program depending on iconv under windows

I have a project depending on iconv, because I need to work with cp1251 codepage. Here is the minimal implementation of the problem project. I has installed iconv from here and successfully installed haskell package "iconv" like this cabal install…
s9gf4ult
  • 862
  • 6
  • 20
6
votes
1 answer

Sparse matrix conversion from Matrix to armadillo with RcppArmadilloExtensions/sp_mat.h

I am trying to use the very recent capability of the RcppArmadillo package (version 0.3.910.0 with R 3.0.1 and evrerything up to date) for conversion of a sparse matrix from the Matrix package (class "dgCMatrix") to the sp_mat type of armadillo. I…
6
votes
3 answers

Compiling Twice with Delphi 6 and getting the same checksum on the binary

For the purposes of binary / source code verification, i'd like to be able to make two compiles on the same computer 2 weeks apart and have the binaries be identical and thus pass some checksum test. So far I've found that most likely the timestamp…
6
votes
2 answers

CMake: How to remove duplicates from target link list?

My argument list for the linker is getting too long and I am receiving the following error at this point: Error running link command: Argument list too long I am using different 3rd party libraries in my application (including Qt, OpenCV,…
Chris
  • 3,245
  • 4
  • 29
  • 53
6
votes
3 answers

CMake linking problem

I am trying to use CMake to compile a C++ application that uses the C library GStreamer. My main.cpp file looks like this: extern "C" { #include #include } int main(int argc, char* argv[]) { GMainLoop *loop; GstElement…
StackedCrooked
  • 34,653
  • 44
  • 154
  • 278
6
votes
4 answers

Using a .lib file in a C# program

I have a header file and a .lib file created using C++. Now I want to use it in a C# program. Is this possible?
user2389323
  • 769
  • 2
  • 10
  • 22
6
votes
3 answers

Houston, we have an undefined reference

MEGAEDIT 3000 I have discovered the cause of undefined references. I checked my .o files for symbols, and they were just missing. Just weren't there. For no apparent reason. I have checked the source of the compromiting .o file, but everything…
matuzalem
  • 367
  • 1
  • 2
  • 14
6
votes
0 answers

How to use --whole-archive with libtool

How can I use --whole-archive with libtool without it being reordered? Background: I'm compiling Extrae (performance profiling) from sources which depends on Dyninst which depends on libdwarf, which, on Debian Wheezy, is provided as a static…
davepc
  • 320
  • 2
  • 10
6
votes
1 answer

C/cmake - how to add a linker flag to an (unused) library when the library is specified in TARGET_LINK_LIBRARIES?

In the root directory of my project, I have a subdirectory for my_lib and another for my_app. The library my_lib defines tables that populates a section defined by the linker, these tables are not used directly by my_app, so this library is not…
Lilás
  • 1,111
  • 1
  • 16
  • 29
6
votes
5 answers

C# Default scope resolution

I have inherited a c# class 'Button' (which I can't change) which clashes with the BCL class 'Windows.Forms.Button'. Normally, Id be very happy to go: MyPackage.MyClass.Button; But there are a large number or references to this class which is a…
TK.
  • 46,577
  • 46
  • 119
  • 147