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
12
votes
1 answer

CUDA external class linkage and unresolved extern function in ptxas file

I'm working with CUDA and I have created an int2_ class to deal with complex integer numbers. Class declarations in the ComplexTypes.h file as follows: namespace LibraryNameSpace { class int2_ { public: int x; …
Vitality
  • 20,705
  • 4
  • 108
  • 146
11
votes
1 answer

Unresolvable `R_X86_64_NONE` relocation

I'm using Devtoolset-7 on CentOS 7 and have built Boost 1.65.1 w/ it. But when I link my application, I've got the following: /opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/ld:…
zaufi
  • 6,811
  • 26
  • 34
11
votes
3 answers

How to fix unresolved externals of SDL 2.0.3 on Visual Studio 2015 Preview?

so i'm getting the following errors: 1>SDL2main.lib(SDL_windows_main.obj) : error LNK2019: unresolved external symbol __imp__fprintf referenced in function _ShowError 1>SDL2main.lib(SDL_windows_main.obj) : error LNK2019: unresolved external symbol…
jape670
  • 141
  • 1
  • 6
11
votes
5 answers

Google Test: error LNK2019: unresolved external symbol with Visual Studio 2013

I'm trying to get my first ever unit test with Google Test framework + Visual Studio 2013.However I'm hitting the below error and can't understand why. 1>------ Build started: Project: FirstGoogleTest, Configuration: Debug Win32 ------ 2>------…
Solti
  • 633
  • 2
  • 6
  • 17
10
votes
3 answers

How to use functions from different C++ projects in Visual Studio 2010?

I would like to build two C++ projects in the same solution in Visual Studio 2010 that can interact with each other. I have created a solution under directory C:\Users\me\Desktop\SolutionDir. The two projects have been created respectively under…
9
votes
1 answer

Link errors when trying to compile against an old STD library and windows SDK

I have an old project that is compiled in VS2005 (Sadly). It has to remain in VS2005 so it can link properly to another process which has the VS2005 CRT,MFC, etc. Now I need to compile this project in VS2015, using the old VS2005 toolset. I've…
9
votes
1 answer

OpenGL/glew unresolved external symbols

I am having issues with glew and linker errors. I have: put glew32.dll and glew32d.dll in system, System32 and SysWOW64 put glew.h in GL folder put glew32.lib, glew32d.lib, glew32s.lib in Lib folder put glew32.lib, glew32d.lib, glew32s.lib,…
8
votes
2 answers

I can't compile a solution due to "Error LNK2028: unresolved token..."

I have a dll programmed in C++, and a exe programmed in Visual C++. I have the functions in dll declared as: string __declspec( dllexport ) ConfigureHAT(T_STRING pathFile); And in the exe project I include all the headers files and the dll file.…
sansub
  • 83
  • 1
  • 1
  • 4
8
votes
1 answer

unresolved windows externals

I am using Visual Studio x64 Win64 Command Prompt(2010) to compile my code. I am getting some errors, that I would normally know how to fix in Visual Studio, but not with just a command line. Output: Microsoft (R) C/C++ Optimizing Compiler Version…
LunchMarble
  • 5,079
  • 9
  • 64
  • 94
8
votes
2 answers

OpenCV won't compile due to unresolved externals -- LNK2019

I am brand new to OpenCV and have been trying to set it up in Visual Studios 2010 Ultimate. I have followed the documentation exactly, and linked the files as it said. Here are the additional libraries that I am…
loganfarr
  • 581
  • 2
  • 4
  • 11
7
votes
1 answer

unresolved external symbol __stdio_common_vswprintf

I'm compiling a kernel mode driver that uses the Microsoft Dmf framework (DmfK.lib) After the last Visual Studio update some strange linker errors appeared : EmulationTargetPDO.obj : error LNK2019: unresolved external symbol __stdio_common_vswprintf…
SamT
  • 528
  • 4
  • 14
7
votes
0 answers

Linker error: undefined reference in a function template that uses external variables

I have a mini project with two files: main.cpp #include template int getint(int i) { extern std::string var; return var.size() * i; } int main() { return getint<2>(2); } and sub.cpp #include extern std::string…
7
votes
4 answers

Magick++ in VS2010 - unresolved external symbol

I'm trying to use ImageMagick Magick++ for a C++ Project in VS2010. I installed the Library from here: klick Then in my Project, I added c:/program files/ImageMagick-6.6.6-Q16/include to the include folders. Then I tried to use Magick++ with this…
Van Coding
  • 24,244
  • 24
  • 88
  • 132
7
votes
4 answers

Unresolved external symbol error occurring only in 64-bit mode and not in 32-bit build

I have a VC++ code (built using VS2008), which makes use of some static libraries (*.lib files linked statically during compile time). For ease of understanding let's refer my EXE code as "AAA.EXE" & refer the lib files as "A.lib", b.lib etc... Both…
codeLover
  • 3,720
  • 10
  • 65
  • 121
7
votes
1 answer

unresolved external

I have an unresolved external symbol error that's driving me nuts. In short, I have a wrapper class for SDL_Surfaces ('DgSurface') and a class to load and store DgSurfaces ('DgSurfaceList'). The link issue arises when trying to include the…
Frank
  • 335
  • 2
  • 10
1
2
3
35 36