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
0 answers

Unresolved external symbol - win32 function

I am trying to compile a project using Qt Creator. But I get error for win32 function. -1: error: LNK2019: unresolved external symbol __imp__FlashWindow@8 referenced in function "private: void __thiscall Proj::runBs(int,long)"…
Ufx
  • 2,595
  • 12
  • 44
  • 83
0
votes
0 answers

Unresolved Externals on Unit Test on Windows Only, Not on Linux using CMake

I've learned that I need to compile my main project as a library, so my unit tests can link to them. This works on Linux, but on Windows, via Visual Studio, it provides unresolved externals. Here's the parent project…
Kevin
  • 979
  • 4
  • 10
  • 22
0
votes
0 answers

error LNK2001 when using complex pow(),log(),exp() in VC++6

I work with VC++6 and I want to use complex power function (pow()) in one of my self-made function. I wrote my necessary functions in a header file (.h). Here is my function in the header file: #include…
0
votes
1 answer

VC++ linker error when using dllimport/dllexport macro to include headers in multiple projects

I have a Visual C++ solution, using Visual Studio 2017, which contains 5 projects: SpikeConfig SpikeEngine SpikeRenderer SpikeUI SpikeUtils In SpikeUtils, I have a header _SpikeEngineObject.h: #pragma once #ifdef DLL_SPIKEUTILS #define…
0
votes
3 answers

Pass pointer to object to dll

I'm writing this Editor.exe program that loads a game.dll, gets the address of a function inside the dll, and pass a pointer to a Core object. gameInitFuncPtr init = (gameInitFuncPtr)…
marciovmf
  • 11
  • 5
0
votes
2 answers

unresolved external symbol glewExperimental

I'm trying to create a window using glew but I am getting this link error. I also tried compiling the libraries myself, which didn't work either. I also made sure that glew is properly linked. Here's the code that's causing the error: if…
sakura
  • 61
  • 6
0
votes
0 answers

Unresolved External Symbol in my Singleton Variable

I have been trying to implement a simple singleton, however I am getting a unresolved external: error LNK2001: unresolved external symbol "private: static class Xeno::Engine * Xeno::Engine::m_instance" (?m_instance@Engine@Xeno@@0PAV12@A) I looked…
Happy Crayfish
  • 47
  • 1
  • 11
0
votes
2 answers

unresolved symbol specialization of templatized method

This code is not able to resolve void K::func(B&). struct K { template void func(T &t); }; struct B { void ok(); }; // definition template void K::func(T &t) { t->ok(); } // getting: undefined reference to `void…
vrdhn
  • 4,024
  • 3
  • 31
  • 39
0
votes
1 answer

Unresolved External Array

I am working on a school project and I am running into a linker error of 'unresolved external symbol' I have two files; math.h and math.cpp. I am trying to declare some arrays in the namespace in math.h, but I am getting linker error from this. In…
0
votes
2 answers

unresolved external symbol on static array of functions

I have an issue with unresolved external symbol in Visual Studio. I’ve tried all combination of the definition, but i still get the message 1>Exada.obj : error LNK2001: unresolved external symbol "public: static int (__cdecl**…
0
votes
2 answers

3 Unresolved external symbols (beginner C++)

my intro computer science class just covered functions this week and after checking the major thread for "Unresolved external symbols" I think it is either a) You declared the functions but never called them after main b) You are missing the correct…
0
votes
0 answers

unresolved external symbol _loadlibrarya_@4 and _getprocaddress_@8 in Fortran

I have problems with Fortran when accessing external DLL. I'm not familiar with Fortran. Error showing here stdcall external LoadLibraryA, GetProcAddress. The code as below: Subroutine GetDLLEntryPoint (EntryPoint,ModuleName) stdcall external…
njz
  • 47
  • 8
0
votes
0 answers

How could a function call cause an unresolved external in some places, but not others?

I've read many of the answers on SO regarding unresolved externals, but only one seemed close to my situation (Unresolved external symbol for some function calls but not all), but the answers don't help. Here's my situation: I'm using VS 2015 and…
0
votes
1 answer

MSVC 2015 / libcurl / unresolved externals _curl_easy_init@0 etc

I'm stucked at getting a DLL compiled that uses libcurl static version. I get the following three functions as unresolved external: 1>curl.obj : error LNK2001: unresolved external symbol _curl_easy_init@0 1>curl.obj : error LNK2001: unresolved…
0
votes
1 answer

Unresolved external symbol calling funtion same .cpp

I am trying to make a program to find saddle points in a matrix. When i try to run it compiler shows errors: [Linker error] undefined reference to min_cols(float (*) [6], float, int, int, int)' , [Linker error] undefined reference…