Questions tagged [undefined-reference]

A linker error caused by a missing definition of a symbol used elsewhere in a program

The most common causes are

  • Declaring but not defining a function, global variable or static data member
  • Not compiling or linking to an object file that contains the definition of a symbol
  • Forgetting to link to the library that provides the symbol
  • Listing a required library before the objects that depend on it (in the linker command libraries should be listed after the objects that depend on them)

There is a C++ FAQ question about undefined references in C++ and how to solve them.

1120 questions
-3
votes
1 answer

undefined reference to "calcyear"

I am new to programming if you could not tell by the advanced code I have laid out for you. I am reading a book on C programming and I copied this code out of it as an exercise and I have no idea why I am getting the error I am. PLEASE HELP!!! I am…
gdubs
  • 11
  • 2
-3
votes
1 answer

error: identifier "ostream" is not defined

Firstly, I have looked all over for solutions and I can't seem to fix it. When trying to compile source code I get the following error. g++ -c -I/home/jcallahan/ACM/include/FANSI -I/home/jcallahan/ACM/FourtyTwo/Base…
jgCallahan
  • 33
  • 1
  • 4
-3
votes
1 answer

c++ object and "undefined reference to" not agree with duplicated

Hello all :) It was a forgotten double declaration with a "extern". Problem I believe it is a problem of object between differents files or a problem of "&" or "*" I have the error line: -lws2_32/tmp/ccBWAJ1F.o: dans la fonction « Z2iav…
user2964288
  • 61
  • 1
  • 11
-4
votes
2 answers

Undefined reference to 'Class::Class(function)'

I've searched through other similar questions and tried everything users have suggested but i'm still getting this error upon compiling. I'm new to c++ and extra new to the std list class, please help me. I've tried to link them using this command,…
jaden8123
  • 1
  • 1
  • 2
-4
votes
2 answers

C++ linker error: undefined reference to

I get the following error message when I try to compile a C++ program in Dev C++ or in Geany: [Linker error] undefined reference to `Reakcijska_pot::Reakcijska_pot()' ld returned 1 exit status My code is: #include using namespace…
-4
votes
2 answers

undefined reference to main in code blocks

A bit of the backstory: I first used Eclipse but it had trouble resolving namespace std so I switched to code::blocks and now I'm having this problem. Everything went through debugging just fine except for one error: In function '_start': undefined…
Siphenx
  • 21
  • 1
  • 5
-5
votes
3 answers

What's the difference between an inner class and an inner inner class in python?

Shouldn't field be undefined on line 50? It was my understanding that inner nested classes did not have visibility to outer classes, as I ran into on line 65... Just seems kind of inconsistent and I would love to have a better understanding of the…
kpie
  • 7,934
  • 5
  • 19
  • 40
-6
votes
2 answers

Weird undefined reference error using typeid() in a CRTP

In regards to give a solution for this question, I tried to simplify my code presented in the answer to use RTTI and the typeid() function to retrieve a class name: #include #include #include struct IDriver { //…
πάντα ῥεῖ
  • 83,259
  • 13
  • 96
  • 175
-6
votes
1 answer

Undefine reference of

When I've try to compile program (test for my lib) I've got undefined reference of for every called method. I've read answers on "gcc undefined reference to", but it has not help. PS I using: Debian 7.2.0 and C++11 standart. #include…
DrMGC
  • 161
  • 2
  • 9
-7
votes
2 answers

Linker Error In C: undefined Reference to "method" c

I have a C file that I am trying to build but it's giving me the Linker Error. The reason being it cannot find the method definition that are defined at other source files. What exactly I am trying to do here is have the definition of the…
user2064676
  • 23
  • 1
  • 3
1 2 3
74
75