SFML community forums

Help => Window => Topic started by: x-ecutioner on February 27, 2010, 07:23:28 pm

Title: Simple Noob error with the Windows Tutorial
Post by: x-ecutioner on February 27, 2010, 07:23:28 pm
Hey guys,

i keep getting a LNK 2019 error in visual c++ 2008 express:
Code: [Select]

1>test.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall sf::Window::~Window(void)" (__imp_??1Window@sf@@UAE@XZ) referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::Display(void)" (__imp_?Display@Window@sf@@QAEXXZ) referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::Window::Window(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > 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
1>test.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
1>C:\Users\bakhtawar\Documents\Visual Studio 2008\Projects\SFMLtictactoe\Debug\SFMLtictactoe.exe : fatal error LNK1120: 4 unresolved externals
1>Build log was saved at "file://c:\Users\*********\Documents\Visual Studio 2008\Projects\SFMLtictactoe\SFMLtictactoe\Debug\BuildLog.htm"
1>SFMLtictactoe - 5 error(s), 0 warning(s)


based on the code i copied from the tutorial:

Code: [Select]

#include <SFML/Window.hpp>

int main(){
// Create the main window
    sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");


bool Running = true;
while (Running)
{
App.Display();
}

return EXIT_SUCCESS;

}


the previous tutorial involving threading and even the very first script with timing worked fine for me so i believe i have appropriately linked to the appropriate SFML:

include files:
(http://img9.imageshack.us/img9/2744/18357227.jpg)

and library files:
(http://img251.imageshack.us/img251/931/14698135.jpg)

as a matter of interest, I am linking to the microsoft SDK based on advice given on this thread from about a year or two ago:
http://www.sfml-dev.org/forum/viewtopic.php?t=244

I also researched heavily and came accross this link, but found that it did not help me:
http://www.sfml-dev.org/forum/viewtopic.php?t=1553&highlight=lnk2019

I also have the following aspects established under my project properties:
(http://img171.imageshack.us/img171/1821/44535143.jpg)

(http://img502.imageshack.us/img502/9903/70534955.jpg)

finally, i am running windows 7, and the ATI Radeon HD 5750 graphics card.

any help would be greatly appreciated.
Title: Simple Noob error with the Windows Tutorial
Post by: Tank on February 27, 2010, 08:03:48 pm
YOu  need to link to sfml-window, too.

Edit: I saw your active configuration is "Debug". Therefore you need to link to "sfml-system-d" and "sfml-window-d".
Title: Simple Noob error with the Windows Tutorial
Post by: x-ecutioner on February 27, 2010, 09:09:23 pm
thank you for your response


however,

i am getting the following error:
Code: [Select]

>LINK : fatal error LNK1104: cannot open file 'sfml-system-d;sfml-window-d.obj'


under additional dependencies
i just put
sfml-system-d;sfml-window-d

any ideas?

thank you

Edit: do i have to change my preprocessor from SFML_DYNAMIC to something else since im running the debug mode?  Or do i have to paste the sfml-system-d and sfml-window-d files into the debug directory of my Visual basic project folder?
Title: Simple Noob error with the Windows Tutorial
Post by: JollyRoger on February 27, 2010, 10:17:26 pm
It appears you forgot the ".lib" at the end.  You should be linking against "sfml-system-d.lib" and "sfml-winodw-d.lib".
Title: Simple Noob error with the Windows Tutorial
Post by: x-ecutioner on February 27, 2010, 11:48:06 pm
thank you both for your help so far

i feel we are getting closer to the exact root of the problem

after adjusting the linker input to exactly
Code: [Select]

Additional dependencies: sfml-system-d.lib;sfml-window-d.lib

i am now getting the following error:

Code: [Select]

1>LINK : fatal error LNK1104: cannot open file 'sfml-system-d.lib;sfml-window-d.lib'


any help would be greatly appreciated
thank you
Title: Simple Noob error with the Windows Tutorial
Post by: OniLinkPlus on February 28, 2010, 08:06:22 am
It thinks the two files are the same file. Have you tried separating with spaces(I don't use MSVC, but it's worth a shot)
Title: Simple Noob error with the Windows Tutorial
Post by: Resnis on March 03, 2010, 11:44:25 pm
I have the same problem, but i have done everything to prevent it. My vc++ just doesn't seem to be able to find sfml.system-d.lib and sfml.graphics-d.lib :(
Code: [Select]
LINK : fatal error LNK1104: cannot open file 'sfml.system-d.lib'
Checked it multiple times. Maybe it has something to do with compilers settings? Altough everything seems to be set and linked right.
EDIT: i was using the graphics tut, but the idea is the same.
Title: Simple Noob error with the Windows Tutorial
Post by: Laurent on March 04, 2010, 07:34:13 am
Can you describe what you did?
Title: Simple Noob error with the Windows Tutorial
Post by: CBenni::O on March 04, 2010, 06:30:01 pm
Have you included the 'lib'  folders of SFML, too?

bye, CBenni::O
Title: Simple Noob error with the Windows Tutorial
Post by: JollyRoger on March 04, 2010, 11:08:13 pm
Unless you renamed the files, you should be linking against "sfml-sytem-d.lib" and "sfml-graphics-d.lib".  There should be a hyphen ("-") in between instead.
Title: Simple Noob error with the Windows Tutorial
Post by: Resnis on March 05, 2010, 12:32:36 pm
Ah, yes, how did i miss that? Thank you!
Then i had the same problem, that OP did - unresolved externals. But linking to sfml-window-d.lib as well, fixed it. The question is - why do i have to use both window and graphics libraries? In the tutorial it is said, that graphics library has the functions needed.
Title: Simple Noob error with the Windows Tutorial
Post by: Laurent on March 05, 2010, 01:04:33 pm
Quote
In the tutorial it is said, that graphics library has the functions needed

The tutorial says that <SFML/Graphics.hpp> includes <SFML/Window.hpp>, nothing more.
Title: Simple Noob error with the Windows Tutorial
Post by: Resnis on March 05, 2010, 01:32:21 pm
Sorry, then it must be my lack of english knowledge.
Thanks for all the help, this library really is simple to learn, getting hang of it right now!
Title: Simple Noob error with the Windows Tutorial
Post by: Resnis on March 06, 2010, 04:55:56 pm
Still having problems with setting up :/
Everything went fine, till text tutorial. VC++ started giving me these errors, when exiting the app:
(http://img25.imageshack.us/img25/9036/errrorj.png)
Wasn't able to find a way to get rid of it, so now I'm asking again for help.

EDIT: i had CodeBlocks, so i tried to set up on them aswell, and it has the same problem. What am i doing wrong?
Title: Simple Noob error with the Windows Tutorial
Post by: Laurent on March 06, 2010, 07:22:27 pm
This is a known bug with sf::String. It doesn't happen if you link to the SFML static libraries.
Title: Simple Noob error with the Windows Tutorial
Post by: Resnis on March 06, 2010, 07:54:57 pm
Yes, that fixed it, and i also got the order wrong, everything is working great now! 8)