All Questions

1076
votes
27answers
376253 views

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? Feel free to edit/add your own.
119
votes
8answers
256482 views

Strange linking error: DSO missing from command line

When I'm compiling openvswitch-1.5.0, I've encountered the following compile error: gcc -Wstrict-prototypes -Wall -Wno-sign-compare -Wpointer-arith -Wdeclaration-after-statement -Wformat-securi...
78
votes
4answers
97548 views

Undefined reference to `sin`

I have the following code (stripped down to the bare basics for this question): #include<stdio.h> #include<math.h> double f1(double x) { double res = sin(x); return 0; } /* The ...
97
votes
5answers
136098 views

Undefined reference to `pow' and `floor'

I'm trying to make a simple fibonacci calculator in C but when compiling gcc tells me that I'm missing the pow and floor functions. What's wrong? Code: #include <stdio.h> #include <math.h&g...
7
votes
2answers
15881 views

"undefined reference to" in G++ Cpp

Can't seem to get the errors to go away. Errors are below. I have looked on google and still can't figure it out. It is not like I am new to Cpp, but have not fooled with it in a while. Weird thing i...
35
votes
5answers
28069 views

Undefined symbols "vtable for ..." and "typeinfo for..."?

Nearly the final step but still some strange erros.... bash-3.2$ make g++ -Wall -c -g Myworld.cc g++ -Wall -g solvePlanningProblem.o Position.o AStarNode.o PRM.o PRMNode.o World.o SingleCircleWorld.o...
43
votes
4answers
72756 views

undefined reference to sqrt (or other mathematical functions)

I have this simple code: max = (int) sqrt (number); and in the header I have: #include <math.h> But application still says undefined reference to sqrt. Do you see any problem here? It look...
30
votes
3answers
32499 views

Undefined reference to a static member

I'm using a cross compiler. My code is: class WindowsTimer{ public: WindowsTimer(){ _frequency.QuadPart = 0ull; } private: static LARGE_INTEGER _frequency; }; I get the following error: ...
34
votes
2answers
74217 views

DSO missing from command line

I am trying to compile a C++ program like this: $ g++ -o Sniffer_Train main.cpp Sniffer_train.cpp Sniffer_train.h -lmysqlclient -lpcap However I get the following error: /usr/bin/ld: /tmp/cct6xeXD...
28
votes
4answers
28941 views

C++ templates, undefined reference

I have a function declared like so: template <typename T> T read(); and defined like so: template <typename T> T packetreader::read() { offset += sizeof(T); return *(T*)(buf+o...

Previous Next