SFML community forums
General => General discussions => Topic started by: Wesloth on February 28, 2008, 10:56:09 pm
-
Hi,
I am really new to C++, so i hope you can help me with my problem.
I tried the tutorial and at beginning all worked well.
This worked well:
#include <SFML/System.hpp>
#include <iostream>
int main()
{
sf::Clock Clock;
while (Clock.GetElapsedTime() < 5.f)
{
std::cout << Clock.GetElapsedTime() << std::endl;
sf::Sleep(0.5f);
}
return 0;
}
After that i tried this one:
include <SFML/Window.hpp>
#include <iostream>
int main()
{
sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");
return 0;
}
But my IDE said:
Blub.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: virtual __thiscall sf::Window::~Window(void)" (??1Window@sf@@UAE@XZ)" in Funktion "_main".
Blub.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""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,int)" (??0Window@sf@@QAE@VVideoMode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KH@Z)" in Funktion "_main".
Blub.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (??0VideoMode@sf@@QAE@III@Z)" in Funktion "_main".
And i dont know what this should be :shock:
Sorry for my english, it's not my native language.
-
have you added all the necessary additional dependencies?
-
To use the Window package, you must link to sfml-window in addition to sfml-system.
-
To use the Window package, you must link to sfml-window in addition to sfml-system.
Thanks, that helped.
But now i get the error:
LINK : fatal error LNK1104: Filei "sfml-window.obj" can not be opened.
edit:
And when i, instead of sfml-window, write sfml-window.lib i get this :shock:
LINK : warning LNK4098: Standardlibrary "MSVCRT" is in conflict with other libraries; /NODEFAULTLIB:library use.
sfml-window.lib(Window.obj) : error LNK2019:""public: void __thiscall sf::Clock::Reset(void)" (?Reset@Clock@sf@@QAEXXZ)" in function ""public: void __thiscall sf::Window::Display(void)" (?Display@Window@sf@@QAEXXZ)".
sfml-window.lib(Window.obj) : error LNK2019:""void __cdecl sf::Sleep(float)" (?Sleep@sf@@YAXM@Z)" in function ""public: void __thiscall sf::Window::Display(void)" (?Display@Window@sf@@QAEXXZ)".
sfml-window.lib(Window.obj) : error LNK2019:""public: float __thiscall sf::Clock::GetElapsedTime(void)const " (?GetElapsedTime@Clock@sf@@QBEMXZ)" in function ""public: void __thiscall sf::Window::Display(void)" (?Display@Window@sf@@QAEXXZ)".
sfml-window.lib(Window.obj) : error LNK2019:""public: __thiscall sf::Clock::Clock(void)" (??0Clock@sf@@QAE@XZ)" in function ""public: __thiscall sf::Window::Window(void)" (??0Window@sf@@QAE@XZ)".
sfml-window.lib(VideoModeSupport.obj) : error LNK2019: "__imp__EnumDisplaySettingsA@12" in function ""public: static class sf::VideoMode __cdecl sf::priv::VideoModeSupport::GetDesktopVideoMode(void)" (?GetDesktopVideoMode@VideoModeSupport@priv@sf@@SA?AVVideoMode@3@XZ)".
sfml-window.lib(WindowImplWin32.obj) : error LNK2019: "__imp__SwapBuffers@4" in function ""private: virtual void __thiscall sf::priv::WindowImplWin32::Display(void)" (?Display@WindowImplWin32@priv@sf@@EAEXXZ)".
]
-
You must still link with sfml-system.lib.
And if you compile in debug configuration, you must use debug libraries instead (sfml-window-d.lib and sfml-system-d.lib).
-
You must still link with sfml-system.lib.
And if you compile in debug configuration, you must use debug libraries instead (sfml-window-d.lib and sfml-system-d.lib).
For all the newbies out there, I found that I also had to turn off Precompiled Headers, in Visual Studio 2008, in order to get my first sample program to work.
Click on Project -> Project Properties
Go to Configuration Properties -> C/C++ -> Precompiled Headers
Change Create/Use Precompiled Header to "Not Using Precompiled Headers"
If this information is wrong, I appologize. But it is what I had to do in order to get it to work for me.
-
I don't think there's something in SFML that prevents from using precompiled headers. Maybe you just didn't use it properly ;)
-
Bit late response here: In your second source code you forgot the # before include...