Questions tagged [linker-errors]

An error received when combining individually compiled object files into executable code.

A is introduced to allow separate compilation of source code into object files and libraries. The linker then pulls the data from each of these files together matching definitions to their implementations in order to create an executable file. Because the linker necessarily requires references to data in other files to be exact name matches, the most common type of linker error is an .

3524 questions
1613
votes
36 answers

What is an undefined reference/unresolved external symbol error and how do I fix it?

What are undefined reference/unresolved external symbol errors? What are common causes and how to fix/prevent them?
125
votes
5 answers

Why am I getting "undefined reference to sqrt" error even though I include math.h header?

I'm very new to C and I have this code: #include #include int main(void) { double x = 0.5; double result = sqrt(x); printf("The square root of %lf is %lf\n", x, result); return 0; } But when I compile this with: gcc…
Ant's
  • 12,571
  • 21
  • 91
  • 141
113
votes
24 answers

Duplicate Symbols for Architecture arm64

When I try running my Xcode Project it fails with an error stating that I have duplicate symbols. I looked online where the find these duplicates but have had no luck: Any ideas how to fix this?
user1445205
112
votes
4 answers

Undefined reference to `sin`

I have the following code (stripped down to the bare basics for this question): #include #include double f1(double x) { double res = sin(x); return 0; } /* The main function */ int main(void) { return 0; } When…
robintw
  • 24,689
  • 48
  • 125
  • 196
79
votes
11 answers

file was built for archive which is not the architecture being linked (i386)

I got to build static library. I want to use in my iPhone and ipad app. When I try to run the simulator I get linking errrors. I am new to iOS development. kindly help; ld: warning: ignoring file …
yarlg
  • 2,556
  • 3
  • 17
  • 18
79
votes
3 answers

Symbol not found: kUTTypeImage

I copied some bits of code from apple's documentation- and I got these 2 errors: Undefined symbols for architecture i386: "_kUTTypeImage", referenced from: -[ImagePicker imagePickerController:didFinishPickingMediaWithInfo:] in…
Lior Pollak
  • 2,701
  • 5
  • 22
  • 46
77
votes
4 answers

C error: undefined reference to function, but it IS defined

Just a simple program, but I keep getting this compiler error. I'm using MinGW for the compiler. Here's the header file, point.h: //type for a Cartesian point typedef struct { double x; double y; } Point; Point create(double x, double y); Point…
upswimsdn
  • 874
  • 1
  • 6
  • 8
74
votes
3 answers

Trying to include a library, but keep getting 'undefined reference to' messages

I am attempting to use the libtommath library. I'm using the NetBeans IDE for my project on Ubuntu linux. I have downloaded and built the library, I have done a 'make install' to put the resulting .a file into /usr/lib/ and the .h files into…
KU1
  • 741
  • 1
  • 6
  • 4
71
votes
5 answers

Undefined reference to sqrt (or other mathematical functions)

I have this simple code: max = (int) sqrt (number); and in the header I have: #include But application still says undefined reference to sqrt. Do you see any problem here? It looks like everything should be okay.
Waypoint
  • 15,705
  • 36
  • 110
  • 167
69
votes
9 answers

Qt Linker Error: "undefined reference to vtable"

This is my header: #ifndef BARELYSOCKET_H #define BARELYSOCKET_H #include //! The First Draw of the BarelySocket! class BarelySocket: public QObject { Q_OBJECT public: BarelySocket(); public slots: void sendMessage(Message…
Thomas
  • 1,425
  • 3
  • 13
  • 24
68
votes
5 answers

Q_OBJECT throwing 'undefined reference to vtable' error

I'm using Qt Creator 2.0.1 with Qt 4.7.0 (32 bit) on Windows 7 Ultimate 32 bit. Consider the following code, which is a minimum to produce the error: class T : public QObject, public QGraphicsItem { Q_OBJECT public: T() {} QRectF …
Donotalo
  • 11,954
  • 23
  • 75
  • 111
64
votes
2 answers

Apple Mach-O Linker Warning "Directory Not Found For Option..."

I simply want to rid of the warnings that pop up like these: ld: warning: directory not found for option '-F/Users/m/Desktop/FacebookSDK' ld: warning: directory not found for option '-F/Users/m/Desktop/FacebookSDK/FBAudienceNetwork' ld: warning:…
Gavin
  • 661
  • 2
  • 6
  • 10
60
votes
2 answers

Multiple definition of ... linker error

I defined a special file: config.h My project also has files: t.c, t.h pp.c, pp.h b.c b.h l.cpp and #includes: in t.c: #include "t.h" #include "b.h" #include "pp.h" #include "config.h" in b.c: #include "b.h" #include…
mazix
  • 2,364
  • 8
  • 33
  • 52
58
votes
7 answers

Unable to compile Rust hello world on Windows: linker link.exe not found

I have installed Rust on windows from Rust installation page. After installation I tried running the "hello world" program but got the following error. >cargo run Error Compiling helloworld v0.1.0 (C:\Users\DELL\helloworld) error: linker…
Zobia Kanwal
  • 2,471
  • 2
  • 12
  • 36
53
votes
4 answers

Unresolved external symbol LNK2019

First of all, I know this question is all over this site but I have looked at almost all of them and can't seem to find out what is wrong. This is in VS 2012. Thanks. //Socket.h #pragma once #include #include using…
Iowa15
  • 2,837
  • 5
  • 24
  • 33
1
2 3
99 100