SFML community forums
Help => Window => Topic started by: rush905 on August 18, 2012, 12:35:12 am
-
Hi everyone. I'm going through the tutorials on the SFML site, and I came across the Windows tutorial. http://www.sfml-dev.org/tutorials/1.6/graphics-window.php (http://www.sfml-dev.org/tutorials/1.6/graphics-window.php) Anyways, I'm using Visual C++, have all the Linker options correct, and the .dlls in place, it even compiles. But in the end when I try to run the program, nothing happens. The process is running in the background, yet nothing's there.
Any help would be great. Thanks.
Source straight from the site:
>http://pastebin.com/kaa1t9UV (http://pastebin.com/kaa1t9UV)
And if it helps, my Source:
> http://pastebin.com/aiy2ra6w (http://pastebin.com/aiy2ra6w)
-
Add while(1); between return and display.
Or put display in loop or something else to stop return line getting executed just after display.
In no debug launching from vc++ the return; doesn't make console/process go away but the app is closed already so the window is gone.
-
Let me guess, you have an ATI graphics card... ::)
It's the so called ATI bug that came with the development of newer cataclyst drivers, this is one of the main reasons why nobody should keep using SFML 1.6. ;)
If you want to get things working you should definitely use SFML 2.0, there are also precompiled library files for the RC (http://www.sfml-dev.org/download.php#2.0-rc). :)
-
I put "App.Display();" inside a loop, and still, nothing happens.
I guess it is the ATI Graphics card. I'll switch to 2.0.
-
I guess it is the ATI Graphics card. I'll switch to 2.0.
You don't have to guess, if you have an ATI graphics card then it is the problem. :D
-
Well I switched, and now I have more problems. This time it's with compiling. I get these two errors when I try to create a Window program:
Error 1 error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup C:\Users\Nick\Desktop\kjhkjh\kjhkjh\MSVCRTD.lib(crtexew.obj)
Error 2 error LNK1120: 1 unresolved externals C:\Users\Nick\Desktop\kjhkjh\Debug\Window.exe 1
http://pastebin.com/qb7LFZJL (http://pastebin.com/qb7LFZJL)
-
With "create a Window program" do you mean that you set the subsystem of your application to window or that you've started of with a window based project?
It's always adviced to start with an completly empty project and do the setup on your own.
Do you link against sfml-main.lib or if you're in debug mode sfml-main-d.lib?
-
Alright, let me start over. I'm in Visual C++, I create a new project, an empty project. I add a blank C++ file. Ok, now that it's made, what do I have to edit in my project's properties window?
And when you say "link against sfml-main.lib" are asking me if I have "sfml-main.lib" in my additional dependencies? If so, I'm in debug and have linked both "sfml-main-d.lib" and "sfml-graphics-d.lib"
Okay, I compiled again with the same source as above, and now I'm getting 8 errors:
Source: http://pastebin.com/Pw7vr9hm (http://pastebin.com/Pw7vr9hm)
Error 1 error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::display(void)" (?display@Window@sf@@QAEXXZ) referenced in function _main C:\Users\Nick\Desktop\Window1\Window1\Window.obj
Error 3 error LNK2019: unresolved external symbol "public: void __thiscall sf::Window::close(void)" (?close@Window@sf@@QAEXXZ) referenced in function _main C:\Users\Nick\Desktop\Window1\Window1\Window.obj
Error 4 error LNK2019: unresolved external symbol "public: bool __thiscall sf::Window::pollEvent(class sf::Event &)" (?pollEvent@Window@sf@@QAE_NAAVEvent@2@@Z) referenced in function _main C:\Users\Nick\Desktop\Window1\Window1\Window.obj
Error 5 error LNK2019: unresolved external symbol "public: bool __thiscall sf::Window::isOpen(void)const " (?isOpen@Window@sf@@QBE_NXZ) referenced in function _main C:\Users\Nick\Desktop\Window1\Window1\Window.obj
Error 7 error LNK2019: unresolved external symbol "public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (??0VideoMode@sf@@QAE@III@Z) referenced in function _main C:\Users\Nick\Desktop\Window1\Window1\Window.obj
Error 6 error LNK2019: unresolved external symbol "public: __thiscall sf::String::String(char const *,class std::locale const &)" (??0String@sf@@QAE@PBDABVlocale@std@@@Z) referenced in function _main C:\Users\Nick\Desktop\Window1\Window1\Window.obj
Error 2 error LNK2001: unresolved external symbol "public: static class sf::RenderStates const sf::RenderStates::Default" (?Default@RenderStates@sf@@2V12@B) C:\Users\Nick\Desktop\Window1\Window1\Window.obj
Error 8 error LNK1120: 7 unresolved externals C:\Users\Nick\Desktop\Window1\Debug\Window1.exe
-
You know there's a reason why tutorials were made, to not having to repeate the same answers all over again. ;)
So if you want to know how to setup Visual Studio just take a look at the official tutorial (http://www.sfml-dev.org/tutorials/2.0/start-vc.php). If you follow it 100% without missing any bits then it's guaranteed to compile and link! :D
-
Okay, I solved the problem. Turns out I had to uninstall Visual C++ because I place the .lib and include files in the Visual C++ directory. I also had to include the sfml-main-d.lib file too. So that fixed the problem. Thanks for the help.