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

Author Topic: [Solved] LNK2001 problem  (Read 1528 times)

0 Members and 3 Guests are viewing this topic.

Alizia

  • Newbie
  • *
  • Posts: 4
    • View Profile
[Solved] LNK2001 problem
« on: August 29, 2018, 07:53:45 pm »
Hello everyone ! Before all, sorry for my approximate english, I'm french.

I'm trying to install SFML for VS 14.0 (2015), I followed the tutorial on this site and I chose dynamic version.

I set include/lib folder and add lib in linker input.




I don't set "SFML_STATIC" in preprocessor option.

I copy libs from /bin to my project folder.


I tried with the "Visual C++ 14 (2015) - 64-bit" version on the download page and with a compiled version with CMake, same linker problem.

I am pretty sure that it's a stupid config problem, but after read and re-read the tutorial and all topic about LNK2001, I can't find a solution.

Thanks for the future help and sorry for the surely trivial mistake.

OS : Windows 10 64Bit
IDE : Visual Studio 2015
SFML : 2.5.0

Source code :
Code: [Select]
// ConsoleApplication1.cpp : définit le point d'entrée pour l'application console.
//

#include "stdafx.h"
#include <cstdlib>
#include <SFML/Graphics.hpp>

using namespace sf;

int main()
{
RenderWindow window(VideoMode(800, 600, 32), "Patate !");

while (window.isOpen())
{
Event event;
while (window.pollEvent(event))
{
if (event.type == Event::Closed)
window.close();
}

// Remplissage de l'écran (couleur noire par défaut)
window.clear();

// Affichage de la fenêtre à l'écran
window.display();
}

return 0;
}


Logs :
Code: [Select]
Erreur LNK2001 symbole externe non résolu "__declspec(dllimport) public: __cdecl sf::RenderWindow::RenderWindow(class sf::VideoMode,class sf::String const &,unsigned int,struct sf::ContextSettings const &)" (__imp_??0RenderWindow@sf@@QEAA@VVideoMode@1@AEBVString@1@IAEBUContextSettings@1@@Z) ConsoleApplication1 C:\Users\Roimi\documents\visual studio 2015\Projects\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1
Erreur LNK2001 symbole externe non résolu "__declspec(dllimport) public: __cdecl sf::String::String(char const *,class std::locale const &)" (__imp_??0String@sf@@QEAA@PEBDAEBVlocale@std@@@Z) ConsoleApplication1 C:\Users\Roimi\documents\visual studio 2015\Projects\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1
Erreur LNK2001 symbole externe non résolu "__declspec(dllimport) public: __cdecl sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QEAA@III@Z) ConsoleApplication1 C:\Users\Roimi\documents\visual studio 2015\Projects\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1
Erreur LNK2001 symbole externe non résolu "__declspec(dllimport) public: virtual __cdecl sf::RenderWindow::~RenderWindow(void)" (__imp_??1RenderWindow@sf@@UEAA@XZ) ConsoleApplication1 C:\Users\Roimi\documents\visual studio 2015\Projects\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1
Erreur LNK2001 symbole externe non résolu "__declspec(dllimport) public: bool __cdecl sf::Window::isOpen(void)const " (__imp_?isOpen@Window@sf@@QEBA_NXZ) ConsoleApplication1 C:\Users\Roimi\documents\visual studio 2015\Projects\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1
Erreur LNK2001 symbole externe non résolu "__declspec(dllimport) public: bool __cdecl sf::Window::pollEvent(class sf::Event &)" (__imp_?pollEvent@Window@sf@@QEAA_NAEAVEvent@2@@Z) ConsoleApplication1 C:\Users\Roimi\documents\visual studio 2015\Projects\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1
Erreur LNK2001 symbole externe non résolu "__declspec(dllimport) public: void __cdecl sf::Window::close(void)" (__imp_?close@Window@sf@@QEAAXXZ) ConsoleApplication1 C:\Users\Roimi\documents\visual studio 2015\Projects\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1
Erreur LNK2001 symbole externe non résolu "__declspec(dllimport) public: void __cdecl sf::RenderTarget::clear(class sf::Color const &)" (__imp_?clear@RenderTarget@sf@@QEAAXAEBVColor@2@@Z) ConsoleApplication1 C:\Users\Roimi\documents\visual studio 2015\Projects\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1
Erreur LNK2001 symbole externe non résolu "__declspec(dllimport) public: __cdecl sf::Color::Color(unsigned char,unsigned char,unsigned char,unsigned char)" (__imp_??0Color@sf@@QEAA@EEEE@Z) ConsoleApplication1 C:\Users\Roimi\documents\visual studio 2015\Projects\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1
Erreur LNK2001 symbole externe non résolu "__declspec(dllimport) public: void __cdecl sf::Window::display(void)" (__imp_?display@Window@sf@@QEAAXXZ) ConsoleApplication1 C:\Users\Roimi\documents\visual studio 2015\Projects\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1
Erreur LNK2001 symbole externe non résolu "__declspec(dllimport) public: __cdecl sf::String::~String(void)" (__imp_??1String@sf@@QEAA@XZ) ConsoleApplication1 C:\Users\Roimi\documents\visual studio 2015\Projects\ConsoleApplication1\ConsoleApplication1\ConsoleApplication1.obj 1
Erreur LNK1120 11 externes non résolus ConsoleApplication1 C:\Users\Roimi\documents\visual studio 2015\Projects\ConsoleApplication1\x64\Release\ConsoleApplication1.exe 1

« Last Edit: August 29, 2018, 10:39:03 pm by Alizia »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: LNK2001 problem
« Reply #1 on: August 29, 2018, 08:56:26 pm »
You specified release libraries (without -d suffix) for both release and debug configuration. In debug mode you need to link debug libraries.

Also you configured the project for Win32, so make sure to use 32-bits libraries.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Alizia

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: LNK2001 problem
« Reply #2 on: August 29, 2018, 10:00:48 pm »
Also you configured the project for Win32, so make sure to use 32-bits libraries.

It was this. Thanks a lot !