Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [SOLVED]LNK2001  (Read 4446 times)

0 Members and 1 Guest are viewing this topic.

SWB

  • Newbie
  • *
  • Posts: 3
    • View Profile
[SOLVED]LNK2001
« on: March 12, 2015, 07:07:33 am »
Hullo

When I compile the following code with the static release sfml libraries that have been correctly linked as far as I can tell.

#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <stdio.h>
#include <conio.h>

int main(){

        sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");

        printf("Press any key continue . . . \n");
        _getch();
        return 0;
}
 

I get the following errors.

Error   1       error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::RenderWindow::~RenderWindow(void)" (__imp_??1RenderWindow@sf@@UAE@XZ)   E:\Visual Studio 2013\Projects\Sprite_Collision\Sprite_Collision\main.obj       Sprite_Collision
Error   4       error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QAE@III@Z)        E:\Visual Studio 2013\Projects\Sprite_Collision\Sprite_Collision\main.obj       Sprite_Collision
Error   3       error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::String::String(char const *,class std::locale const &)" (__imp_??0String@sf@@QAE@PBDABVlocale@std@@@Z)  E:\Visual Studio 2013\Projects\Sprite_Collision\Sprite_Collision\main.obj       Sprite_Collision
Error   5       error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::String::~String(void)" (__imp_??1String@sf@@QAE@XZ)     E:\Visual Studio 2013\Projects\Sprite_Collision\Sprite_Collision\main.obj       Sprite_Collision
Error   2       error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::RenderWindow::RenderWindow(class sf::VideoMode,class sf::String const &,unsigned int,struct sf::ContextSettings const &)" (__imp_??0RenderWindow@sf@@QAE@VVideoMode@1@ABVString@1@IABUContextSettings@1@@Z)     E:\Visual Studio 2013\Projects\Sprite_Collision\Sprite_Collision\main.obj       Sprite_Collision
Error   6       error LNK1120: 5 unresolved externals   E:\Visual Studio 2013\Projects\Sprite_Collision\Release\Sprite_Collision.exe    Sprite_Collision
 

I'm compiling on Microsoft Visual Studio 2013 on Windows 64 but using 32 bit libraries.
« Last Edit: March 12, 2015, 10:04:24 am by SWB »

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: LNK2001
« Reply #1 on: March 12, 2015, 07:14:27 am »

SWB

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: LNK2001
« Reply #2 on: March 12, 2015, 07:28:31 am »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11035
    • View Profile
    • development blog
    • Email
Re: LNK2001
« Reply #3 on: March 12, 2015, 08:43:16 am »
Please read the official tutorials carefully. If you link SFML statically, you need to define SFML_STATIC.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

SWB

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: LNK2001
« Reply #4 on: March 12, 2015, 10:03:41 am »
Thanks
I thought i had defined it in my release configuration but i had only defined it in my debug one