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

unresolved symbol with supplied FTDI library

I'm using VS2015 to make a simple SPI interface using an FTDI MPSSE cable. They supply the following files to use as an interface to their hardware. libMPSSE.a libMPSSE.lib libMPSSE.dll libMPSSE.h libMPSSE_spi.h I'm using a simple project just to…
Andre
  • 69
  • 1
  • 1
  • 7
0
votes
1 answer

Unresolved external symbol using Direct2D

I am trying to download and build the 'WIC Image Viewer usign Direct2D' from here, but when I build my solution, I am slapped with 56 errors that look like: Error 1 error LNK2019: unresolved external symbol __imp__CoUninitialize@0 referenced…
Freakishly
  • 1,533
  • 5
  • 32
  • 61
0
votes
0 answers

Unresolved Externals |Object Oriented Application

** Edit, here's the pictures of my linking stuff... : ** https://i.stack.imgur.com/w8F3z.jpg So, I keep getting the "unresolved Externals" error which I can't fix. I've read lots of different posts about this on different sites none of them have…
Happy Crayfish
  • 47
  • 1
  • 11
0
votes
1 answer

Unresolved External Symbol With Normal Header/Source Setup

I'm making a basic C++ setup. There is a main file, which calls a function, quickSort from another file, qSort.h/qSort.cpp. However, when I try to do so I get unresolved external symbol, which means that the function prototype is visible, but not…
WarSame
  • 870
  • 1
  • 10
  • 24
0
votes
0 answers

Why static library not working?

I tried making this simple static library in Code::Blocks with MinGW: #include #include #include "header.h" extern int go(int x) { struct timeval t; gettimeofday(&t, NULL); return 1; } This same snippet works if…
0
votes
0 answers

unresolved external: D3DXSaveSurfaceToFile

I am compiling a simple code to capture screenshot using GetBackBufer() method and here is my complete code for reference: // include the basic windows header files and the Direct3D header files #include #include #include…
0
votes
0 answers

Defining a struct imported from DLL works only when its constructor is defined in the header file

Problem: error LNK2019: unresolved external symbol "public: __thiscall Vector3::Vector3(void)" (??0Vector3@@QAE@XZ) referenced in function _WinMain@16 Details: I have a custom Vector3 class with its basic constructor Vector3() which is declared in…
pseudomarvin
  • 1,477
  • 2
  • 17
  • 32
0
votes
1 answer

unresolved external error (d3d)

When ever I try to execute this code D3DXCreateFont(d3dDevice, 20, 0, FW_BOLD, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, choiceFont, &Font); I get this error Error 1 error LNK2019:…
Coloriez
  • 73
  • 9
0
votes
1 answer

Unresolved External symbol, C++, VS 2015

I have read the model answer on unresolved externals and found it to be incredibly useful and have got it down to just these last two stubborn errors which are beyond me. I've attached all the code just in case, if you would like to see the headers…
zephyr9581
  • 3
  • 1
  • 3
0
votes
1 answer

Unresolved external symbol from a console application in visual studio

I created a console application project(let's call it ProjectA) in visual studio, and another project which is the googletest project to test the ProjectA. Now I got unresolved external symbol problem when testing functions that have definition in…
Yichao Zhao
  • 129
  • 6
0
votes
2 answers

Forward-declare struct which only has definition in a library cpp

I'm using the bullet 3 physics library, which has the following struct definition inside one of the cpps: struct btSingleContactCallback : public btBroadphaseAabbCallback { btCollisionObject* m_collisionObject; btCollisionWorld* m_world; …
0
votes
1 answer

First c++ file and header LNK2019 error

This is my first time having separate files and first time writing a header file, however I keep getting the same error I can't fix. Here are the files: //main.cpp #include #include "Bike.h" /* class Bike{ public: int…
Mick
  • 89
  • 9
0
votes
1 answer

boost::thread & member function

I've facing this problem when trying to use boost::thread: unresolved external symbols: public: __thiscall boost::thread::~thread(void) public: __thiscall boost::thread::thread(void) Does anyone have any idea?
csa
  • 71
  • 1
  • 2
0
votes
1 answer

Weird unresolved external errors in linked objects

Using Visual Studio 10 C++, I'm having weird link error. For some reason references to a global object won't link to that global object. It is telling me a symbol is undefined yet when I have it view the .cod file the symbol is right there plain as…
jmucchiello
  • 18,754
  • 7
  • 41
  • 61
0
votes
2 answers

C++ SFML Gamedev Book - Unresolved External Symbol from ResourceHolder class

I have the following three files, of which I cannot find the source of an error that it is producing: Main.cpp #include #include #include "ResourceHolder.h" namespace Textures { enum ID { Landscape, Airplane,…
user5057712