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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Lowest0ne

Pages: [1]
1
General / [SOLVED] Link error due to object files (I think)
« on: April 24, 2013, 05:32:00 pm »
My friends and I are having some trouble getting a project to statically link to SFML.

I happen to have a different project that links just fine (statically).  So I've been trying to figure out differences.  For my computer (WindowsXP, MinGW), the issue seems to stem from making a .o.

main.cpp:
#include <SFML/Graphics.hpp>
int main()
{
    sf::RenderWindow window;
    return 0;
}

I can compile with this command line:
Code: [Select]
g++ -I../../include main.cpp -o test.exe -DSFML_STATIC -L../../lib/sfml -lsfml-graphics-s -lsfml-window-s -lsfml-system-s
However, if I do this:
Code: [Select]
g++ -I../../include -c main.cpp -o main.o
g++ -I../../include main.o -o test.exe -DSFML_STATIC -L../../lib/sfml -lsfml-graphics-s -lsfml-window-s -lsfml-system-s
I get link errors: Undefined reference to sf::RenderWindow

Is there something that I am missing?

Thanks


2
Window / Getting key pressed events to work
« on: July 16, 2012, 04:54:18 pm »
Hi all,

I'm teaching myself OpenGL, using SFML for a context.  I've finally gotten to the point where I want to be able to move the camera.  So you know, press 'w' and the camera's "move foward" becomes true.

I'm having a problem getting the input to actually trigger something though.  My guess is there is something simple I'm just missing, perhaps some one can help.
// My main function is where the message loop is:
sf::Event pEvent;
bool open = (app.isOpen()? true : false);
while (open)
{              
        while (app.pollEvent(pEvent))
        {
                open = prgEvent(pEvent);                               
        }
        display();
        app.display();
}
app.close();
delete model;
delete terra;
delete cam;
return 0;

// prgEvent(pEvent) takes the event and splits it into types,
// returning false if program should end
bool prgEvent(sf::Event& pEvent)
{
        //  A false return signals the end of the program
        switch (pEvent.type)
        {
        case sf::Event::KeyPressed: return prgKeyPressed(pEvent.key.code);
        case sf::Event::Closed: return false;  // Note that this works
        }
        return true;
}

//prgKeyPressed() makes a switch on the actual key

#define print1(x) std::cout << x << '\n'
bool prgKeyPressed(sf::Keyboard::Key& kpCode)
{
        // A false return signals the end of the program
        switch (kpCode)
        {

        case sf::Keyboard::Escape: print1(kpCode); return false;
        }
        return true;
}
 
@Exploiter: Like those tags? :)

So, in the case of sf::Keyboard::Escape I print kpCode (which is 36), and then return false, right?

I get 36 printing on console, but the program doesn't quit.  Like I said, I must be missing something here.

Thanks

3
General / Runtime Errors - WinXP, MinGW (not code::blocks)
« on: July 08, 2012, 08:42:26 pm »
Hi all,

I'm having some troubles getting SFML up and running with MinGW.  I'm very new to MinGW/Coding/makefiles/sfml, so any help is appreciated.

Here is enough info (I think) to at least point out a maybe.


I have all the needed .dlls in the folder, and I also get this crash when I run the exe not in msys.

I've tried just about every Win32 release (1.6 and 2.0) trying to get them to work.  I've noted that the 2.0 example programs (well, pong) don't work on my computer.  I thought I had 1.6 working, but now back to the drawing board.

I guess I'll try getting this working in VS and see if I can replicate it for MinGW?

Thanks.

4
General / Beginner - SFML wait for message
« on: June 28, 2012, 10:03:19 pm »
Hi all, I just installed SFML and went through the "make a window" tutorial.  Almost everything is okay :)

I'm sure this question is asked a lot...  The program using all of the computer's resources (100% of a CPU and 1000 FPS).  I would like to be able to make the program do nothing unless it gets a message to do something (you know, like notepad).  Is this possible?

Pages: [1]