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

C++ Class Static Members

So I have my header file with static members: #ifndef PROFILE_MANAGER_H #define PROFILE_MANAGER_H #include #include using namespace std; using std::vector; namespace Engine { class ProfileManager { private: …
Bob
  • 821
  • 1
  • 17
  • 36
-1
votes
1 answer

How do I follow this linker error?

I'm working my first internship, still trying to get this horrible thing to compile on Visual Studio 2008. I've spent a week playing around with IDE settings and Windows SDK installs and I don't think I'm going to make any more headway in that…
-2
votes
1 answer

Linking error in an xll context with visual studio : general linking issue or particular?

I have A.h and A.lib. My project links to A in the sense that the path to A.lib is added into "additional libraries" path in visual studio (in "linker, general"), and A.lib is added in "linker input" in visual studio. All header and source files are…
Olórin
  • 3,367
  • 2
  • 22
  • 42
-2
votes
1 answer

C++ - Unresolved External in DLL Injector

I can't really see the reason I am getting this error, I have had a look arround and apparently it's something to do with defining a function that does nothing? I can't really tell what the issue is here unfortunately so any help would be…
-2
votes
1 answer

Unresolved external symbol in qt project

Okay so spend 30 min or so having a look at common causes for this issue and I can't see what is wrong. The error I am getting is unresolved external symbol. The symbol in question being a class called AdventureDocs. The header is as…
user2801678
  • 21
  • 1
  • 5
-2
votes
1 answer

GOBJECT : unresolved externals symbol ___chkstk_ms

On compiling GOBJECT in Visual Studio, I came across below two errors: Error 5 error LNK1120: 1 unresolved externals C:\gtk_compilation\glib\glib-2.46.0\build\win32\vs12\Debug\Win32\bin\gobject-2-vs12.dll gobject Error 4 error LNK2019:…
sjsam
  • 21,411
  • 5
  • 55
  • 102
-2
votes
2 answers

LNK2019: unresolved external symbol C++ converting Fahrenheit to Celcius

#include #include using namespace std; int main() { // declare variables string name; float fahrenheit, celcius; //display greeting cout << "Please enter your first name: "; cin >> name; //ask for fahrenheit …
Nora
  • 11
  • 1
  • 9
-2
votes
1 answer

Unresolved external symbol LNK2001, LNK2011, LNK2019

I have no idea what's wrong with my code. I have include guards in all my header files. Since there is quite some code and I'd like to keep it private the question is rather how I'd go about solving these errors. Error 1 error LNK2001: unresolved…
-2
votes
1 answer

Error unresolved externals and unresolved external symbol

I get an error of unresolved externals error LNK1120 and error LNK2019: unresolved external symbol "void __cdecl crt_acc(class std::basic_string,class std::allocator > * const,int)"…
Hollow Looi
  • 57
  • 1
  • 7
-3
votes
1 answer

error LNK2019: unresolved external symbol method referenced in function

Here's my problem error report: Error 2 error LNK2019: unresolved external symbol "public: int __thiscall item::getSubstanceDurability(enum myEnums::MATERIAL)" (?getSubstanceDurability@item@@QAEHW4MATERIAL@myEnums@@@Z) referenced in function…
RaenirSalazar
  • 556
  • 1
  • 7
  • 20
-4
votes
1 answer

QT how to include a header and cpp file

I have a qt project that is setup like this headers mainwindow.h source main.cpp mainwindow.cpp in the mainwindow.h just some function prototypes no includes in the mainwindow.cpp #include "mainwindow.h" some code in the main.cpp #include…
-5
votes
1 answer

Unresolved reference to constructor which is defined

I am getting an unresolved external symbol "public: __thiscall TestLanguage::TestLanguage(void)" (??0TestLanguage@@QAE@XZ) referenced in function _main The TestLanguage constructor is defined as far as I can see, however obviously the compiler can't…
brettwhiteman
  • 4,210
  • 2
  • 29
  • 38
1 2 3
35
36