2

Undefined reference error refers to missing declaration or the definition or both?

Compiler: GCC on Linux

Aquarius_Girl
  • 21,790
  • 65
  • 230
  • 411

3 Answers3

4

While it is technically compiler specific, "undefined reference" almost always means - as the error message states - that the definition is missing. I don't know of any compiler that would complain of an "undefined reference" when an unDECLARED symbol is being referenced.

Gerald
  • 23,011
  • 10
  • 73
  • 102
1

i had the same problem using the library with Qt. the solution is to specify the path which leads to the -lblob file in the .pro file:

LIBS += -L/user/local/lib \
-lblob
laalto
  • 150,114
  • 66
  • 286
  • 303
lova
  • 11
  • 1
  • 1
    This is a very special case, not an answer to the question whether "undefined reference" is caused by missing declarations or definitions. – jogojapan Jun 03 '13 at 08:43
  • @jogojapan From the rest of the answers anyone could get an idea of what's going on, it doesn't hurt to add a QT specific answer. Actually, it helps. Also, it is invisible but I suppose the most people who do find this useful are the same people who will not login and not upvote normally... Also, at times when people come here with a mind that usually don't seem to have the luxury of actually getting the picture at their disposal, letting then them have a chance to find the QT specific version might be what they need at the moment... – n611x007 Mar 22 '17 at 09:37
1

Usualy (if not always?) it's a linker error and it means missing definition. Compilation errors for missing declarations are similar to: "XXX was not declared in this scope."

jrok
  • 54,456
  • 9
  • 109
  • 141