SFML community forums
Help => Window => Topic started by: alucard33592 on February 01, 2012, 07:07:25 pm
-
have no idea what this error means, I probably did something wrong while setting up sfml spent about 30 minutes searching for the answer, basically I want the program to open a window click on an area then click on a second area. Right now I cant even get it to open up the window.........
#include<iostream>
#include<windows.h>
#include<SFML/Window.hpp>
#include<SFML/Graphics.hpp>
using namespace std;
int main ()
{
sf::Window App (sf::VideoMode(800, 600 , 32), "SFML window");
cout << "Hi, now the mouse is on X = 450 and Y = 780 :)";
SetCursorPos(450, 780);
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); // Left click
mouse_event(MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0); // Right click
return 0;
}
Compiling: main.cpp
Linking console executable: bin\Debug\test.exe
obj\Debug\main.o: In function `main':
C:/Users/Tim.Tim-PC/Desktop/testing stuff/test/main.cpp:12: undefined reference to `_imp___ZN2sf9VideoModeC1Ejjj'
C:/Users/Tim.Tim-PC/Desktop/testing stuff/test/main.cpp:12: undefined reference to `_imp___ZN2sf12RenderWindowC1ENS_9VideoModeERKSsmRKNS_14WindowSettingsE'
C:/Users/Tim.Tim-PC/Desktop/testing stuff/test/main.cpp:12: undefined reference to `_imp___ZN2sf12RenderWindowD1Ev'
C:/Users/Tim.Tim-PC/Desktop/testing stuff/test/main.cpp:22: undefined reference to `_imp___ZN2sf12RenderWindowD1Ev'
C:/Users/Tim.Tim-PC/Desktop/testing stuff/test/main.cpp:22: undefined reference to `_imp___ZN2sf12RenderWindowD1Ev'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)
5 errors, 0 warnings
-
Hello,
You have probably made an incorrect linking with SFML libraries. Can you show your link settings ?
-
yeah O.o thanks for the heads up I did a bit looking around that general area and found what I did wrong but a new problem showed up it compiled just fine with now errors but the window just showed up and did nothing I could re-size it and minimize it though when I tried to close it it froze for a moment before going away
not the window created by sfml but the standard cmd ish window that usuailly pops up
-
Two things stick out to me looking at your example.
1) Your program doesn't really do much; there isn't a loop it keep it running. It's just going to exit right after it starts.
2) I don't think you can use those WinAPI functions, SetCursorPos and mouse_event, like that inside a SFML window. SFML has a built-in mouse class for that purpose.
-
Ah I used them before without sfml and it worked fine now I'm trying to set up a user interface for a program I made that would automate clicks on the screen I know that code sample doesnt do much and yeah....no loop yet to keep it running I was gonna add that later after I got the errors worked out of what it actuailly did I also found out that sfml has some trouble with the graphics card that I'm using so I found a tutorial on youtube to build 2.0 with cmake .....anyway after I get sfml in a workable position on my computer I'll post the full source code in my thread =D
-
:shock: