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

Author Topic: LNK2019 error  (Read 1471 times)

0 Members and 1 Guest are viewing this topic.

DavidD

  • Newbie
  • *
  • Posts: 2
    • View Profile
LNK2019 error
« on: February 20, 2011, 06:21:58 pm »
Hey there!

I must be either retarded or I missed something. I am trying to compile the example that deals with opening a window but I get 4 LNK2019 errors. Here's the code:

Code: [Select]

#include <SFML/Window.hpp>

int main()
{
sf::Window App(sf::VideoMode(800, 600, 32), "Simple Window");

while (true)
{
App.Display();
}

return EXIT_SUCCESS;
}


I copied the lib and include folders to my visual studio 9.0/VC folder, added the include/lib folders in Visual Studio 2008, added the "sfml-system.lib" to the linker's additional dependencies and I set the preprocessor definitions to "SFML_DYNAMIC;"

Then I opened the "SFML.sln" in the "SFML-1.6/build/vc2008", and compiled each of the options just to be safe, then I copied the .dll's from the lib directory to every folder in my project's folder in my documents.

Still, Errors:

Code: [Select]

Compiling...
main.cpp
Linking...
main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::Window::~Window(void)" (__imp_??1Window@sf@@UAE@XZ) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::Display(void)" (__imp_?Display@Window@sf@@QAEXXZ) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Window::Window(class sf::VideoMode,class std::basic_string,class std::allocator > const &,unsigned long,struct sf::WindowSettings const &)" (__imp_??0Window@sf@@QAE@VVideoMode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KABUWindowSettings@1@@Z) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QAE@III@Z) referenced in function _main
C:\Users\David\Documents\Visual Studio 2008\Projects\Horse\Debug\Horse.exe : fatal error LNK1120: 4 unresolved externals


This isn't going very well, I'd appreciate help

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
LNK2019 error
« Reply #1 on: February 20, 2011, 06:29:50 pm »
Did you try to read any tutorial, documentation or search the forum?

You have forgotten to link against the window library. The system library only contains stuff that is common to all modules of SFML.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

DavidD

  • Newbie
  • *
  • Posts: 2
    • View Profile
LNK2019 error
« Reply #2 on: February 20, 2011, 06:35:52 pm »
Quote from: "Groogy"
Did you try to read any tutorial, documentation or search the forum?

You have forgotten to link against the window library. The system library only contains stuff that is common to all modules of SFML.


I read the tutorial on this site http://www.sfml-dev.org/tutorials/1.6/window-window.php and http://www.sfml-dev.org/tutorials/1.6/start-vc.php

I had no idea you had to link against any windows library nor do I know how to do that

EDIT: Well I know HOW to do it but not which library to link to.. I also added sfml-window.lib and sfml-main.lib and now the error is gone but no window pops up

EDIT 2: http://www.sfml-dev.org/forum/viewtopic.php?t=4123 says that it might be my ATI card. Great.