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 external symbol on virtual function

Each of these classes are in separate dll modules: class Base { public: virtual void foo(); void bar(); }; class Derived : public Base { public: // override Base::foo() void foo(); }; In Other.cpp: #include "Derived.h" The module that…
Jason
  • 1
  • 1
  • 1
0
votes
1 answer

unresolved external symbol "private: static float ObjectInfo::Rotation

#include class ObjectInfo{ private: static float Rotation; public: //sets object rotation value void SetR(float a){ static float Rotation = a; } //print roation value (I think this is where the problem is located) …
GameHog
  • 73
  • 1
  • 7
0
votes
1 answer

Unresolved External Symbol Error w/ Classes

#include #include using namespace std; class Phone { public: int countryCode, areaCode, mainNum; string type; Phone::Phone(); void Phone::setPhone(); void getPhone(); }; Phone::Phone() { countryCode =…
Adam G
  • 23
  • 2
0
votes
1 answer

Unsolved external symbol error when building project

I need to implement a linked list and I have trouble finding an error in my code. I know that unsolved external symbol means that I probably have a function declaration and no implementation, but I looked through my code and I can't see what's…
Asalas77
  • 612
  • 4
  • 15
  • 26
0
votes
1 answer

Unresolved external symbol referenced in function _main

I found this issue (see the title of my question) many times on the internet and at stackoverflow although most often related to objects. No objects here. Just plain C/C++. I tried most of the suggestions to solve it. Nothing worked. The code below…
0
votes
1 answer

Which function to use instead of pci_find_bus in esxi

I am trying to compile a driver for esxi that originally run under linux. When i try to load it vmkload i get the following error/warning WARNING: Elf: 1508: Relocation of symbol failed: Unresolved symbol Because It is not defined in…
yaron
  • 439
  • 6
  • 16
0
votes
1 answer

Dynamic math library - unresolved externals

At first I would like to point out that I'm new to linking, libraries and stuff. I'm trying to implement simple math library (dynamic) for vectors and matrices. I'm using Visual Studio. Let's say I have 2 projects, one si DLL and other is console…
mezo
  • 423
  • 1
  • 7
  • 19
0
votes
0 answers

VOCE Compiling error unresolved external

When I compile the .cpp show this error (VISUAL STUDIO 2008) : error LNK2001: unresolved external symbol "extern "C" long __stdcall JNI_CreateJavaVM(struct JavaVM_ * *,void * *,void *)" (?JNI_CreateJavaVM@@$$J212YGJPAPAUJavaVM_@@PAPAXPAX@Z) I…
0
votes
0 answers

Unresolved external symbols LNK2019 when copying and pasting project

I'm attempting to submit some of my coursework, which involves me zipping up the project. However whenever I copy and paste (or zip) my project, it no longer works in the copied version (original works perfectly). I can't for the life of me figure…
Niamh
  • 33
  • 1
  • 5
0
votes
1 answer

LNK2019 unresolved external symbol in constructor despite having definition in cpp

I am sure this question has been asked before, but I've searched the SO as much I could and still couldn't find the exact reason for the error. Thus posting a new one. I am using a C++ library (txmpp) in my project. The library is added properly,…
0xC0DED00D
  • 19,522
  • 20
  • 117
  • 184
0
votes
0 answers

TinyXML TiXmlDocument::StreamOut unresolved at link time

Using TinyXML with TIXML_USE_STL (anyway doesn't change behavior) My code TiXmlDocument doc(pszFileName); bool loadOkay = doc.LoadFile(); if (!loadOkay) {_ASSERTE(0); return(0);} I just got one and only one unresolved: unresolved…
Gordon88
  • 64
  • 3
0
votes
0 answers

Unresolved Externals Error in C++

I'm coding a game of Pong and have run into some compiler errors that I can't seem to fix. Here's my header file: #include "stdafx.h" #include #include #include #include #include #include
0
votes
1 answer

Unresolved External Symbol Errors when using header and class definition files

I'm sure my variable declarations and defintions are all over the place but thats not the point. For this assignment, we were given a main cpp file which we could not edit and have to make a header and class cpp file. I'm getting unresolved external…
0
votes
1 answer

File failing to write accurate data to a text file

//My name is Chris Salazar and this is Assignment 7. This program is an upgraded grading program #include #include #include #include using namespace std; const int…
0
votes
0 answers

I have "unresolved externals"

#include #include #include #include using namespace std; const int STUDENTS = 100; struct studentType { string fname; string lname; int test1; …