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

Why can't linker see my (definitely defined) externals?

I have a class with a header and a .cpp file. I declare my functions in the header, and define them in the .cpp file, as you would. Header: #pragma once // my #includes class CDNAGenerator { private: // stuff public: CDNAGenerator(int,…
technorabble
  • 391
  • 7
  • 16
0
votes
3 answers

Unresolved external issue when compiling multi-source files

I have a project that consists of 2 CPP files (main.cpp and Car.cpp) and a header file (Car.h). The program is meant to allow a user to enter the model, make, and speed of a car and displays the modified speed. My issue is that when I compile the…
tserran
  • 53
  • 1
  • 4
  • 13
0
votes
0 answers

How to get the WTTLog.lib and wttlogger.h header file for 64-bit version of WTTLog.DLL

This is in continuation for the thread "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…
codeLover
  • 3,720
  • 10
  • 65
  • 121
0
votes
4 answers

OpenCv unresolved external symbol error in Visual Studio

I have linked to the libraries I want to use and added the header files to my project. And the code doesn't show any errors in red squiggle but when I try to run it, it gives me the following error: Error 1 error LNK2001: unresolved external…
Jos
  • 468
  • 1
  • 7
  • 20
0
votes
0 answers

object of template class

I have a template class as follows. template class Manager { Manager(std::string name ); }; template Manager::Manager(std::string name) { //Do something; } When I tried to create an object of this…
Aneesh Narayanan
  • 3,220
  • 11
  • 31
  • 48
0
votes
1 answer

app failing to link to mysql libraries (CentOS)

The link step gets undefined references for all my mysql calls: ~/private/WDI/git$ make c++ -L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -lrt -ldl -o tom tom.o Block.o IPC.o ConnectMxctl.o CI_Metadata.o Log.o tom.o: In function…
Chap
  • 3,649
  • 2
  • 46
  • 84
0
votes
1 answer

error LNK2019: unresolved external symbol cvSmooth referenced in function "void __cdecl example2_4(struct _IplImage *)"

I hope that anyone familiar with openCV and image processing will help me soon. I'm absolutely new to openCV and VC++ and this is the third time this week, I've encountered the error LNK2019. I know that this error means that the .lib file…
Sepideh Abadpour
  • 2,550
  • 10
  • 52
  • 88
0
votes
1 answer

Multi-dimensional matrix initialization to ones using opencv gives a linking error

I have a strange error using opencv under visual studio 11. When I do this: int sz[]={3,3,3}; T=Mat(3,sz,CV_32F); or this (2D matrix initialized to ones): T=Mat::ones(3,3,CV_32F); everything works fine but this (3D matrix initialized to ones): int…
0
votes
2 answers

Removed the C runtime library, and i am receiving some unresolved externals

hey guys i am working on an application and i removed the CRT to save alot of space in the executable and making it as small as possible :) the thing is that when i removed the CRT i also received tons of errors on unresolved external and i was able…
0
votes
0 answers

Linking C++CLI projects result in unresolved tokens and externals

I'm having difficulties linking C++ CLI projects. In one of my CLR projects I have a native baseclass (containing managed methods and members) which I'm trying to inherit to a subclass in another project. The compiler gives the following…
0
votes
3 answers

C++ unresolved symbols

I'm getting an unresolved symbol error at linking in my proj. Im linking to an external library, and yes i have set up the configuration correctly, but when in Debug it outputs the following error for every class in the external library: error…
Jac
  • 46
  • 1
  • 2
0
votes
4 answers

C++ Unresolved External - Template

I am getting an unresolved external compile error when compiling my template classes. I have separated the code into .h and .cpp files. I read some posts and now I understand that this will not work due to linking issues as explained in this…
Sellorio
  • 1,806
  • 1
  • 16
  • 32
0
votes
0 answers

Unresolved External Symbol Linker error

I have a linker problem in my project. I am using a class, NXU_helper, which came with an NVIDIA PhysX physics engine. I have both the header and cpp files, as well as the other files included in them. In my project, I included the header…
user2399378
  • 829
  • 2
  • 10
  • 23
0
votes
0 answers

Unresolved external between several projects in VS2010 C++

I have two C++ projects which each form a library to be referenced by a third project all as part of a Visual Studio solution. The two libraries were written by someone else who also provided his own VS solution which included a project which acts…
EP_Guy
  • 95
  • 7
0
votes
1 answer

Unresolved Externals when using polymorphism

Hi i'm getting the following errors: Error 9 error LNK1120: 2 unresolved externals Error 8 error LNK2019: unresolved external symbol "public: virtual __thiscall physics::~physics(void)" (??1physics@@UAE@XZ) referenced in function "public: virtual…
Eduardo
  • 6,900
  • 17
  • 77
  • 121