Questions tagged [unresolved-external]

For questions about code that compiles but does not link due to unresolved external symbols. It is important that questions include the full linker command as well as the minimal program that references the name in question.

"Unresolved external symbol" is a linker error. It often means that some function has a declaration, but not a definition.

A common cause of this error is compiling code against a library's headers, but failing to link with that library's code: missing the library from the link command, or picking up a different version of the library.

There is a FAQ: What is an undefined reference/unresolved external symbol error and how do I fix it?. If your question lacks the full linker command, and shows no evidence of having read those answers, do not be surprised if you are redirected there.


How to write a good question

  • Create the simplest reproducible program to demonstrate the issue. A simple way to do this in C is to take the address of the symbol and use it:

    #include <pthread.h>
    
    int main()
    {
        int (*a)(pthread_t) = pthread_detach;
        return !a;
    }
    
  • Show the command used to link the program, and its output:

    gcc -std=c11 -fPIC unresolved-external.c -o unresolved-external
    
    /tmp/user/1432/ccI38tid.o: In function `main':
    unresolved-external.c:5: undefined reference to `pthread_detach'
    collect2: error: ld returned 1 exit status
    
537 questions
0
votes
2 answers

Unresolved Externals between functions

I'm getting an unresolved external error but I can't figure out exactly what's causing it. error LNK2019: unresolved external symbol "public: __thiscall ABC::ABC(class ABC const &)" (??0ABC@@QAE@ABV0@@Z) referenced in function "public: __thiscall…
0
votes
1 answer

unresolved external symbol visual studio 2010 error

i've implemented with visual studio 2010 professional a solution containing 2 projects; the first called OptDll consist of a dynamic library with a method i want to export, while the second is a exe project, called prova, in order to try the…
0
votes
1 answer

Unresolved externals, other threads left me confused

I have this program that is being used to read student names and which class they're in from a file and I'm getting this unresolved external error. I've looked for an hour online about it and can't find anything. Here is the error: Error 3 error…
Midge
  • 59
  • 2
  • 5
  • 13
0
votes
1 answer

LNK 2019 Unresolved External Symbol Error

I get the following errors when I try to compile my VS2012 project: error LNK2019: unresolved external symbol "public: int __thiscall map::GetBlockRef(int,int)" (?GetBlockRef@map@@QAEHHH@Z) referenced in function "public: void __thiscall…
Tobias Sundell
  • 117
  • 1
  • 6
0
votes
1 answer

Visual Studio referencing header and source files

I have a C project in visual studio that is named "Framework". The Framework project is supposed to hold common code that should be shared among different projects. I also have another project (Lets call it A) that should use code from the…
Michael
  • 796
  • 11
  • 27
0
votes
0 answers

What is the cause of LNK2001: unresolved external symbol in only one project

I has core dll library called Lib1, I has main application that depends on Lib1 and another extension dll library called POS, It also depend on Lib1, I add the Lib1 as in the references of the project properties, it see the .lib automatically. I…
ahmedsafan86
  • 1,776
  • 1
  • 26
  • 49
0
votes
0 answers

C++ using a static library within a project

I have a static library project that I am trying to use in a Win32 form project. I am using visual studio and C++. Here is what I have done: Added the library project to the solution. Included the library project's header in stdafx.h of the form…
0
votes
2 answers

C++ unresolved externals with simple class definition

I keep getting an ununderstood "unresolved externals error from C++ from Visual Studio 2013. Thank you very much for your help so far. I have reduced the code even more to the following form (but the Problem persists): main.cpp: #include…
Michael
  • 11
  • 4
0
votes
2 answers

C++ Unresolved symbol

I just don't see where I went wrong. The compiler complains about Error 215 error LNK2001: Unresolved external symbol ""class std::vector,class std::allocator >,class…
tmighty
  • 10,734
  • 21
  • 104
  • 218
0
votes
2 answers

C++ very simple unresolved external

I have an unresolved external in Visual Studio C++ compiler that's driving me absolutely crackers. The class header and source files are extremely simple. Header file: // Header file: Rational.h class Rational { public: Rational ( int = 0, int…
OliKlima
  • 41
  • 6
0
votes
1 answer

LNK2019 & LNK1120 Unresolved Externals Probably an easy fix, but I'm having real trouble

I've been getting these LNK2019s for a little while now and can't seem to find a way to get rid of them. I'm aware that there are a lot of threads on these errors already, but I've yet to find anything that's helped me so hoped someone might miss…
0
votes
1 answer

LuaJava compile error "Unresolved external symbol"

Finally I compiled it. Main mistake was about VS enviromental variables. To compile and link proper I needed to type %VisualStudoFolder%\VC\vcvarsall.bat amd64 nmake -f makefile Default LuaJava distributions provides only 32-bit binaries.…
AlpenDitrix
  • 322
  • 2
  • 8
0
votes
1 answer

C++ Unresolved external symbol when using wofstream

I am compiling and linking this source code from a batch file and the libraries that I am importing right now are MSVCRT.LIB Kernel32.lib User32.lib The code works until I include string iostream and fstream and create some wofstream objects. That's…
ali
  • 10,927
  • 20
  • 89
  • 138
0
votes
0 answers

Linker error after converting from Visual Studio 2008 to 2010

I've a project composed from two parts: static library(lib) + header with utils main application(executable, mfc, opengl) I've included header file in the main project files, and added library path and dependency to linker, everything worked ok on…
0
votes
2 answers

Unresolved external when trying to use .lib/.dll

I am trying to add ANN(open source k-d tree for fast nearest neighbor searching) to my VC++ project. I followed the manual and completed every step: include the .h files copy the .lib file, add its location to the linker additional directory copy…