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

Unresolved external when just adding an incomplete type in class in header

I don't understand why the linker says it can't find this function when I add something to my class. // In .h file class Importer {public: void importOBJFile(); } // In .cpp file // INCLUDE ALL THE ASSIMP LIBRARY HEADERS HERE void…
Zebrafish
  • 11,682
  • 3
  • 43
  • 119
-1
votes
1 answer

Trying to incorporate sound within a beacon region in Swift

I am getting "Use of unresolved identifier 'player' in my code using beacons and regions. For this particular region, I also want it to play a sound (Siren.wav). Code is below: import Combine import CoreLocation import SwiftUI import…
rob
  • 21
  • 2
-1
votes
1 answer

Kotlin - Unresolved Reference

I have question regarding about the onStrike variable. I declare onStrike in UnionEmployee as: var onStrike = False. Then, I go to the main function and create an object of UnionEmployee as x, but when I want to set x.onStrike = true it…
Jimmy
  • 1
  • 1
-1
votes
1 answer

Unresolved external symbol on using function from library

i have write small noobie library. All functions working good except templated function. There is my code, when i use this code without library build & work success but when used with library giving unresolved external error. Project & Library…
RequireBool
  • 48
  • 1
  • 6
-1
votes
1 answer

unresolved operator for my classes (separate interface and implementation) C++

Actually my question is simple. I am defining two separate classes and I overload + operator in the first class to accept the second class as its operand. But there is a linking problem (for now I am omitting const for member function). Please note…
-1
votes
1 answer

Unresolved Functions in Properly Coded and Debuged Namespace

I have been trying to resolve several issues with a proof of concept test project in MSVS 15 for a few days now. The issues I am seeing are that there are some functions in a namespace that cannot be resolved. None of the top questions in the…
Geowil
  • 624
  • 1
  • 12
  • 36
-1
votes
1 answer

compiler errors with function declaration c++

I get the following compiler error when I try to build my program: main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall OddsCalculator::is_straight_flush(__int64)" (?is_straight_flush@OddsCalculator@@QAE_N_J@Z) referenced in…
-1
votes
1 answer

C++ unresolved external symbol with 50% chance on 2 virtual abstract methods

Visual Studio 2015, 2 classes and real ambiguity. Class ICommandLine has next relevant code: class ICommandLine { public: virtual void CL_AssignCommandExecMaps() abstract; virtual void CL_RecieveCommand(string) abstract; …
Mr Hungry
  • 46
  • 3
-1
votes
1 answer

LNK2001: unresolved external symbol "void __cdecl func1(struct Stru1 *)"

Let me edit the question: The files are: file1.h file1.c file3.h file2.h file2.c file4.h file5.h main_code.cpp file1.h #include "file3.h" typedef struct{} Str1; void func1(Str1 *str1); void func2(Str1 *str1); file1.c #include "file3.h" #include…
Carlos Siestrup
  • 1,031
  • 2
  • 13
  • 33
-1
votes
1 answer

Eclipse import org.jgrapht cannot be resolved

I have a project in Java in Eclipse (found it on www) but after importing it as a file system, i get continusly the unresolved errors for those two imports: import org.jgrapht.graph.DefaultDirectedWeightedGraph; import…
-1
votes
1 answer

Error LNK 2019 unresolved external symbol for calling matlab engin from c++

I've tested almost every solution found on the net to solve this problem.I'm trying to plot some arrays of spheres in c++ by calling the matlab engine. I did all steps according to this video: https://www.youtube.com/watch?v=vQ5aIxCX3To However it…
-1
votes
1 answer

What is causing this LNK2019 Unresolved external symbol error?

I've been trying to figure out how to fix this, but I simply cannot see what is wrong. The error message(s) are as follows; error LNK2019: unresolved external symbol "public:_thiscall Circle::Circle(coid)" (??0Circle@@QAE@XZ) reference in function…
NeoKuro
  • 457
  • 1
  • 5
  • 21
-1
votes
1 answer

C++ error LNK2001: unresolved external symbol

I have a compiling problem in my project. I have read tons of post with this error on the title but I couldn't fix it. I am receiving this error: Error 4 error LNK2019: unresolved external symbol "public: class vtkUnstructuredGrid * __thiscall…
-1
votes
1 answer

Error in linking external variable c++

I have main.cpp program which include a header file. The implementation of the functions are in other cpp file.
Finlay Lifny
  • 43
  • 1
  • 6
-1
votes
1 answer

C++ Template, different declaration and definition, linker not able to resolve the symbols

Doing simple template code given here; just that I am writing separate declaration and definition This is my header file template class SmartPointerGen { private: T* pData; public: SmartPointerGen(T* pValue); …
user2783263
1 2 3
35
36