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

Author Topic: Event.Type doesn't work  (Read 7669 times)

0 Members and 1 Guest are viewing this topic.

M squared

  • Newbie
  • *
  • Posts: 22
    • View Profile
Event.Type doesn't work
« on: February 25, 2011, 09:22:26 pm »
Whenever I try to use Event.Type, I get 38 unresolved externals? Anyone know how to fix this? I pretty sure it is the Event.Type modifier because
when I remove it, the program works fine.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Event.Type doesn't work
« Reply #1 on: February 25, 2011, 09:24:14 pm »
We need to see the code and errors.
Laurent Gomila - SFML developer

M squared

  • Newbie
  • *
  • Posts: 22
    • View Profile
Event.Type doesn't work
« Reply #2 on: February 26, 2011, 12:01:10 am »
Oh, right, sorry.
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>

int main()
{
    // Create the main rendering window
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");
   
    // Start game loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();
        }

        // Clear the screen (fill it with black color)
        App.Clear();

        // Display window contents on screen
        App.Display();
    }

    return EXIT_SUCCESS;
}
I basically was just testing this in my compiler, I just ripped it right from the tutorial.

Here are the errors.....

1>sfml-Window-s-d.lib(VideoModeSupport.obj) : error LNK2019: unresolved external symbol __imp__EnumDisplaySettingsA@12 referenced in function "public: static void __cdecl sf::priv::VideoModeSupport::GetSupportedVideoModes(class std::vector<class sf::VideoMode,class std::allocator<class sf::VideoMode> > &)" (?GetSupportedVideoModes@VideoModeSupport@priv@sf@@SAXAAV?$vector@VVideoMode@sf@@V?$allocator@VVideoMode@sf@@@std@@@std@@@Z)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__ShowWindow@8 referenced in function "public: __thiscall sf::priv::WindowImplWin32::WindowImplWin32(void)" (??0WindowImplWin32@priv@sf@@QAE@XZ)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__CreateWindowExA@48 referenced in function "public: __thiscall sf::priv::WindowImplWin32::WindowImplWin32(void)" (??0WindowImplWin32@priv@sf@@QAE@XZ)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__CreateWindowExW@48 referenced in function "public: __thiscall sf::priv::WindowImplWin32::WindowImplWin32(void)" (??0WindowImplWin32@priv@sf@@QAE@XZ)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__SetWindowLongA@12 referenced in function "public: __thiscall sf::priv::WindowImplWin32::WindowImplWin32(void *,struct sf::WindowSettings &)" (??0WindowImplWin32@priv@sf@@QAE@PAXAAUWindowSettings@2@@Z)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__GetClientRect@8 referenced in function "public: __thiscall sf::priv::WindowImplWin32::WindowImplWin32(void *,struct sf::WindowSettings &)" (??0WindowImplWin32@priv@sf@@QAE@PAXAAUWindowSettings@2@@Z)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__AdjustWindowRect@12 referenced in function "public: __thiscall sf::priv::WindowImplWin32::WindowImplWin32(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned long,struct sf::WindowSettings &)" (??0WindowImplWin32@priv@sf@@QAE@VVideoMode@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KAAUWindowSettings@2@@Z)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__ReleaseDC@8 referenced in function "public: __thiscall sf::priv::WindowImplWin32::WindowImplWin32(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned long,struct sf::WindowSettings &)" (??0WindowImplWin32@priv@sf@@QAE@VVideoMode@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KAAUWindowSettings@2@@Z)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__GetDeviceCaps@8 referenced in function "public: __thiscall sf::priv::WindowImplWin32::WindowImplWin32(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned long,struct sf::WindowSettings &)" (??0WindowImplWin32@priv@sf@@QAE@VVideoMode@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KAAUWindowSettings@2@@Z)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__GetDC@4 referenced in function "public: __thiscall sf::priv::WindowImplWin32::WindowImplWin32(class sf::VideoMode,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsigned long,struct sf::WindowSettings &)" (??0WindowImplWin32@priv@sf@@QAE@VVideoMode@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@KAAUWindowSettings@2@@Z)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__UnregisterClassA@8 referenced in function "public: virtual __thiscall sf::priv::WindowImplWin32::~WindowImplWin32(void)" (??1WindowImplWin32@priv@sf@@UAE@XZ)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__UnregisterClassW@8 referenced in function "public: virtual __thiscall sf::priv::WindowImplWin32::~WindowImplWin32(void)" (??1WindowImplWin32@priv@sf@@UAE@XZ)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__DestroyWindow@4 referenced in function "public: virtual __thiscall sf::priv::WindowImplWin32::~WindowImplWin32(void)" (??1WindowImplWin32@priv@sf@@UAE@XZ)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__DestroyIcon@4 referenced in function "public: virtual __thiscall sf::priv::WindowImplWin32::~WindowImplWin32(void)" (??1WindowImplWin32@priv@sf@@UAE@XZ)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__DispatchMessageA@4 referenced in function "private: virtual void __thiscall sf::priv::WindowImplWin32::ProcessEvents(void)" (?ProcessEvents@WindowImplWin32@priv@sf@@EAEXXZ)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__TranslateMessage@4 referenced in function "private: virtual void __thiscall sf::priv::WindowImplWin32::ProcessEvents(void)" (?ProcessEvents@WindowImplWin32@priv@sf@@EAEXXZ)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__PeekMessageA@20 referenced in function "private: virtual void __thiscall sf::priv::WindowImplWin32::ProcessEvents(void)" (?ProcessEvents@WindowImplWin32@priv@sf@@EAEXXZ)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__SwapBuffers@4 referenced in function "private: virtual void __thiscall sf::priv::WindowImplWin32::Display(void)" (?Display@WindowImplWin32@priv@sf@@EAEXXZ)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__SetCursor@4 referenced in function "private: virtual void __thiscall sf::priv::WindowImplWin32::ShowMouseCursor(bool)" (?ShowMouseCursor@WindowImplWin32@priv@sf@@EAEX_N@Z)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__LoadCursorA@8 referenced in function "private: virtual void __thiscall sf::priv::WindowImplWin32::ShowMouseCursor(bool)" (?ShowMouseCursor@WindowImplWin32@priv@sf@@EAEX_N@Z)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__SetCursorPos@8 referenced in function "private: virtual void __thiscall sf::priv::WindowImplWin32::SetCursorPosition(unsigned int,unsigned int)" (?SetCursorPosition@WindowImplWin32@priv@sf@@EAEXII@Z)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__ClientToScreen@8 referenced in function "private: virtual void __thiscall sf::priv::WindowImplWin32::SetCursorPosition(unsigned int,unsigned int)" (?SetCursorPosition@WindowImplWin32@priv@sf@@EAEXII@Z)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__SetWindowPos@28 referenced in function "private: virtual void __thiscall sf::priv::WindowImplWin32::SetPosition(int,int)" (?SetPosition@WindowImplWin32@priv@sf@@EAEXHH@Z)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__GetWindowLongA@8 referenced in function "private: virtual void __thiscall sf::priv::WindowImplWin32::SetSize(unsigned int,unsigned int)" (?SetSize@WindowImplWin32@priv@sf@@EAEXII@Z)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__SendMessageA@16 referenced in function "private: virtual void __thiscall sf::priv::WindowImplWin32::SetIcon(unsigned int,unsigned int,unsigned char const *)" (?SetIcon@WindowImplWin32@priv@sf@@EAEXIIPBE@Z)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__CreateIcon@28 referenced in function "private: virtual void __thiscall sf::priv::WindowImplWin32::SetIcon(unsigned int,unsigned int,unsigned char const *)" (?SetIcon@WindowImplWin32@priv@sf@@EAEXIIPBE@Z)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__RegisterClassA@4 referenced in function "private: void __thiscall sf::priv::WindowImplWin32::RegisterWindowClass(void)" (?RegisterWindowClass@WindowImplWin32@priv@sf@@AAEXXZ)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__RegisterClassW@4 referenced in function "private: void __thiscall sf::priv::WindowImplWin32::RegisterWindowClass(void)" (?RegisterWindowClass@WindowImplWin32@priv@sf@@AAEXXZ)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__ChangeDisplaySettingsA@8 referenced in function "private: void __thiscall sf::priv::WindowImplWin32::SwitchToFullscreen(class sf::VideoMode const &)" (?SwitchToFullscreen@WindowImplWin32@priv@sf@@AAEXABVVideoMode@3@@Z)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__SetPixelFormat@12 referenced in function "private: void __thiscall sf::priv::WindowImplWin32::CreateContext(class sf::VideoMode const &,struct sf::WindowSettings &)" (?CreateContext@WindowImplWin32@priv@sf@@AAEXABVVideoMode@3@AAUWindowSettings@3@@Z)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__ChoosePixelFormat@8 referenced in function "private: void __thiscall sf::priv::WindowImplWin32::CreateContext(class sf::VideoMode const &,struct sf::WindowSettings &)" (?CreateContext@WindowImplWin32@priv@sf@@AAEXABVVideoMode@3@AAUWindowSettings@3@@Z)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__DescribePixelFormat@16 referenced in function "private: void __thiscall sf::priv::WindowImplWin32::CreateContext(class sf::VideoMode const &,struct sf::WindowSettings &)" (?CreateContext@WindowImplWin32@priv@sf@@AAEXABVVideoMode@3@AAUWindowSettings@3@@Z)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__TrackMouseEvent@4 referenced in function "private: void __thiscall sf::priv::WindowImplWin32::ProcessEvent(unsigned int,unsigned int,long)" (?ProcessEvent@WindowImplWin32@priv@sf@@AAEXIIJ@Z)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__GetAsyncKeyState@4 referenced in function "private: void __thiscall sf::priv::WindowImplWin32::ProcessEvent(unsigned int,unsigned int,long)" (?ProcessEvent@WindowImplWin32@priv@sf@@AAEXIIJ@Z)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__MapVirtualKeyA@8 referenced in function "private: static enum sf::Key::Code __cdecl sf::priv::WindowImplWin32::VirtualKeyCodeToSF(unsigned int,long)" (?VirtualKeyCodeToSF@WindowImplWin32@priv@sf@@CA?AW4Code@Key@3@IJ@Z)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__DefWindowProcA@16 referenced in function "private: static long __stdcall sf::priv::WindowImplWin32::GlobalOnEvent(struct HWND__ *,unsigned int,unsigned int,long)" (?GlobalOnEvent@WindowImplWin32@priv@sf@@CGJPAUHWND__@@IIJ@Z)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__DefWindowProcW@16 referenced in function "private: static long __stdcall sf::priv::WindowImplWin32::GlobalOnEvent(struct HWND__ *,unsigned int,unsigned int,long)" (?GlobalOnEvent@WindowImplWin32@priv@sf@@CGJPAUHWND__@@IIJ@Z)
1>sfml-Window-s-d.lib(WindowImplWin32.obj) : error LNK2019: unresolved external symbol __imp__CallWindowProcA@20 referenced in function "private: static long __stdcall sf::priv::WindowImplWin32::GlobalOnEvent(struct HWND__ *,unsigned int,unsigned int,long)" (?GlobalOnEvent@WindowImplWin32@priv@sf@@CGJPAUHWND__@@IIJ@Z)
1>C:\Users\Menart\Documents\Visual Studio 2010\Projects\SFML tutorial1\Debug\SFML tutorial1.exe : fatal error LNK1120: 38 unresolved externals

.....yeah....

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Event.Type doesn't work
« Reply #3 on: February 26, 2011, 12:17:59 am »
Can I ask what version of SFML you are using? If it's 2.0 you'll have to define SFML_STATIC.

Also are you linking the libraries correctly?
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

M squared

  • Newbie
  • *
  • Posts: 22
    • View Profile
Event.Type doesn't work
« Reply #4 on: February 26, 2011, 07:21:45 pm »
Quote from: "Groogy"
Can I ask what version of SFML you are using? If it's 2.0 you'll have to define SFML_STATIC.

Also are you linking the libraries correctly?

Yes it is SFML 2. So thats probably my problem.
I'm pretty sure i'm linking the libraries correctly though.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Event.Type doesn't work
« Reply #5 on: February 26, 2011, 08:23:10 pm »
Which SFML libraries do you link?
Laurent Gomila - SFML developer

M squared

  • Newbie
  • *
  • Posts: 22
    • View Profile
Event.Type doesn't work
« Reply #6 on: February 26, 2011, 08:45:13 pm »
Window and graphics.
Btw, sorry for my bad vocabulary, but what do you mean by define?

MahanGM

  • Newbie
  • *
  • Posts: 18
    • Yahoo Instant Messenger - mahan_pro2000
    • View Profile
    • http://www.df-gamez.com
Event.Type doesn't work
« Reply #7 on: February 26, 2011, 08:56:55 pm »
hi. Maybe my answer will be stupid but In the linker error it's wrote sfml-Window-s-d. First I dont know exactly if the name of additional libraries are case sensitive (I mean write sfml-window-s-d instead sfml-Window-s-d) or not and the next one is, it shows that you are in debugging mode so you just need to write sfml-window-d. So my additional libraries is like this:
sfml-system-d.lib sfml-window-d.lib.

By the way, did you copied the dlls in u'r executable path !?

I hope that solve u'r problem.  :D
This is a land of broken hearts, where bullets shatter dreams (50 Cent)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Event.Type doesn't work
« Reply #8 on: February 26, 2011, 10:34:48 pm »
Quote
Yes it is SFML 2. So thats probably my problem.

Indeed it is. "define" means going to the C/C++ -> preprocessor options and adding "SFML_STATIC" to the list of defined symbols.
Laurent Gomila - SFML developer

M squared

  • Newbie
  • *
  • Posts: 22
    • View Profile
Event.Type doesn't work
« Reply #9 on: February 27, 2011, 03:58:48 pm »
Quote from: "Laurent"
Quote
Yes it is SFML 2. So thats probably my problem.

Indeed it is. "define" means going to the C/C++ -> preprocessor options and adding "SFML_STATIC" to the list of defined symbols.

Hmm, still not working, It's the preprocessor definitions right? I tried it in all config and debug... I still get the same errors for some reason.

EDIT: I linked the dlls but now i get this error
1>C:\SFML\trunk\lib\vc2008\sfml-window-d.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x300

As far as I now, I double checked and I typed it in right, so......

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Event.Type doesn't work
« Reply #10 on: February 27, 2011, 08:49:21 pm »
Quote
EDIT: I linked the dlls but now i get this error
1>C:\SFML\trunk\lib\vc2008\sfml-window-d.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x300

1. you don't need to link to dynamic versions, static is fine if you prefer it
2. you must link to .lib files, not .dll
Laurent Gomila - SFML developer

M squared

  • Newbie
  • *
  • Posts: 22
    • View Profile
Event.Type doesn't work
« Reply #11 on: February 28, 2011, 05:04:41 pm »
Quote from: "Laurent"
Quote
EDIT: I linked the dlls but now i get this error
1>C:\SFML\trunk\lib\vc2008\sfml-window-d.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x300

1. you don't need to link to dynamic versions, static is fine if you prefer it
2. you must link to .lib files, not .dll

Oh, well, I linked the .lib files and removed the .dll's and it still doesn't work. It still doesn't work though. Just to make sure i'm getting this right, SFML_STATIC goes in active (debug) -> c/c++ -> preproccesor -> Preproccesor Definitions -> edit -> (Type in SFML_STATIC)

MahanGM

  • Newbie
  • *
  • Posts: 18
    • Yahoo Instant Messenger - mahan_pro2000
    • View Profile
    • http://www.df-gamez.com
Event.Type doesn't work
« Reply #12 on: February 28, 2011, 06:08:09 pm »
You shouldn't remove dlls from u'r debug path and you should link lib files in ide. if everything goes right, definitely there isn't any matter to stuck you.
This is a land of broken hearts, where bullets shatter dreams (50 Cent)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Event.Type doesn't work
« Reply #13 on: February 28, 2011, 08:17:40 pm »
Quote
Yes it is SFML 2

Quote
C:\SFML\trunk\lib\vc2008\sfml-window-d.dll

Quote
C:\Users\Menart\Documents\Visual Studio 2010\Projects\SFML tutorial1\Debug\SFML tutorial1.exe

This needs some clarification ;)
SFML 1.6, trunk or 2.0?
VS 2008 or 2010?
Laurent Gomila - SFML developer

M squared

  • Newbie
  • *
  • Posts: 22
    • View Profile
Event.Type doesn't work
« Reply #14 on: March 03, 2011, 10:59:40 pm »
Quote from: "Laurent"
Quote
Yes it is SFML 2

Quote
C:\SFML\trunk\lib\vc2008\sfml-window-d.dll

Quote
C:\Users\Menart\Documents\Visual Studio 2010\Projects\SFML tutorial1\Debug\SFML tutorial1.exe

This needs some clarification ;)
SFML 1.6, trunk or 2.0?
VS 2008 or 2010?

I'm using VS 2010, but I never renamed the folder so the folder is titled vc2008. I'm using the sfml from the URL https://sfml.svn.sourceforge.net/svnroot/sfml
as found here http://www.sfml-dev.org/wiki/en/tutorials/getsvnversion.

 

anything