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.


Messages - mchughq

Pages: [1]
1
General / Re: Build SFML 2.1 Program From MinGW
« on: May 02, 2014, 01:56:48 am »
Ok, I have a recent development. I removed the static requests from the command changing it to "g++ main.o -o main.exe -LC:\SFML-2.1\lib -lsfml-system -lsfml-window -lsfml-graphics" and it created an .exe! Once I put the .dll's into the same directory, I ran the .exe and got an error from windows saying "main.exe has stopped working. Windows is checking for a solution to the problem". Any suggestions? I feel like I'm getting really close!

2
General / Re: Build SFML 2.1 Program From MinGW
« on: May 02, 2014, 12:50:45 am »
@Ixrec I re-downloaded the 32 bit gcc version of SFML just to be safe and there was no difference, so I guess I had the correct version to start with.

@eXpl0it3r There is no reason I am linking statically, it's just the way I saw it being done. Also, do you think it should really matter if I download the latest version of MinGW? I feel like my issues are related to something else.

3
General / Re: Build SFML 2.1 Program From MinGW
« on: May 02, 2014, 12:25:27 am »
I just tried "g++ main.o -o main.exe -LC:\SFML-2.1\lib -DSFML_STATIC -lsfml-system-s -lsfml-window-s -lsfml-graphics-s" and I got the same ream of errors.

4
General / Re: Build SFML 2.1 Program From MinGW
« on: May 02, 2014, 12:12:07 am »
I just tried switching the order to system, window, graphics and I got the identical error messages.

5
General / Build SFML 2.1 Program From MinGW
« on: May 02, 2014, 12:05:45 am »
Here's the situation: I'm on the heels of finishing an IDE which is somewhat of a gift to my high school CS teacher. One of the very last, and admittedly most important features of the IDE, is the ability to compile an SFML project. Currently I'm trying to get SFML to simply compile from the command prompt. These are the locations of my resources:

  • main.cpp (see source below) - C:\Users\Quinn McHugh\Desktop\test\main.cpp (Nothing else in this folder)
  • MinGW (unmodified lib/ and include/ directories) - C:\MinGW\include\c++\3.4.5 (this is in my path variable)
  • SFML 2.1 - C:\SFML-2.1

First what I do is navigate to the folder titled test inside the command prompt, next I type the command "g++ -c -IC:\SFML-2.1\include main.cpp". As far as I can tell, this compiles without issue and produces the file main.o. Next is where the problems appear. I now try to link this whole project together with the command "g++ main.o -o main.exe -LC:\SFML-2.1\lib -DSFML_STATIC -lsfml-graphics -lsfml-window -lsfml-system", and I get these errors:

main.o:main.cpp:(.text+0xd1): undefined reference to `_imp___ZN2sf6StringC1EPKcR
KSt6locale'
main.o:main.cpp:(.text+0xf7): undefined reference to `_imp___ZN2sf9VideoModeC1Ej
jj'
main.o:main.cpp:(.text+0x132): undefined reference to `_imp___ZN2sf6WindowC1ENS_
9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE'
main.o:main.cpp:(.text+0x162): undefined reference to `_imp___ZN2sf6Window5close
Ev'
main.o:main.cpp:(.text+0x178): undefined reference to `_imp___ZN2sf6Window9pollE
ventERNS_5EventE'
main.o:main.cpp:(.text+0x18a): undefined reference to `_imp___ZNK2sf6Window6isOp
enEv'
main.o:main.cpp:(.text+0x1a1): undefined reference to `_imp___ZN2sf6WindowD1Ev'
main.o:main.cpp:(.text+0x1cf): undefined reference to `_imp___ZN2sf6WindowD1Ev'
main.o:main.cpp:(.text+0x1f9): undefined reference to `_imp___ZN2sf6WindowD1Ev'
collect2: ld returned 1 exit status
 

main.cpp:
#include <SFML/Window.hpp>
int main()
{
    sf::Window window(sf::VideoMode(800, 600), "My window");
    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }
    }
    return 0;
}
 

What must I change to successfully be able to run this sfml project?

6
General / Re: Compile Project on Windows Via Cmd
« on: May 01, 2014, 04:42:00 pm »
I dropped all the .lib files into "C:\MinGW\lib" and everything under "C:\SFML-2.1\include" into "C:\MinGW\include\c++\3.4.5". I believe this is even more progress but I'm getting a new set of errors:
C:\Users\QUINNM~1\AppData\Local\Temp\ccKJDzvN.o:main.cpp:(.text+0xd1): undefined
 reference to `sf::String::String(char const*, std::locale const&)'
C:\Users\QUINNM~1\AppData\Local\Temp\ccKJDzvN.o:main.cpp:(.text+0xf5): undefined
 reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int
)'
C:\Users\QUINNM~1\AppData\Local\Temp\ccKJDzvN.o:main.cpp:(.text+0x12e): undefine
d reference to `sf::Window::Window(sf::VideoMode, sf::String const&, unsigned in
t, sf::ContextSettings const&)'
C:\Users\QUINNM~1\AppData\Local\Temp\ccKJDzvN.o:main.cpp:(.text+0x15c): undefine
d reference to `sf::Window::close()'
C:\Users\QUINNM~1\AppData\Local\Temp\ccKJDzvN.o:main.cpp:(.text+0x170): undefine
d reference to `sf::Window::pollEvent(sf::Event&)'
C:\Users\QUINNM~1\AppData\Local\Temp\ccKJDzvN.o:main.cpp:(.text+0x180): undefine
d reference to `sf::Window::isOpen() const'
C:\Users\QUINNM~1\AppData\Local\Temp\ccKJDzvN.o:main.cpp:(.text+0x195): undefine
d reference to `sf::Window::~Window()'
C:\Users\QUINNM~1\AppData\Local\Temp\ccKJDzvN.o:main.cpp:(.text+0x1c1): undefine
d reference to `sf::Window::~Window()'
C:\Users\QUINNM~1\AppData\Local\Temp\ccKJDzvN.o:main.cpp:(.text+0x1e9): undefine
d reference to `sf::Window::~Window()'
collect2: ld returned 1 exit status
 

7
General / Re: Compile Project on Windows Via Cmd
« on: May 01, 2014, 04:19:24 pm »
Ok, I believe I'm making progress on this problem. I'm now entering the command "g++ -Ic:\SFML-2.1\include -o main.o main.cpp -DSFML_STATIC -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -lsfml-audio-s -static-libstdc++" and I get the following errors:

c:/mingw2/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot fi
nd -lsfml-graphics-s
c:/mingw2/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot fi
nd -lsfml-window-s
c:/mingw2/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot fi
nd -lsfml-system-s
c:/mingw2/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot fi
nd -lsfml-audio-s
 

What am I doing wrong? How do I get the sfml-...-s libraries?

8
General / Re: Compile Project on Windows Via Cmd
« on: May 01, 2014, 02:02:49 pm »
@metsuro Where did you get all the -lsfml libraries from?

9
General / Re: Compile Project on Windows Via Cmd
« on: April 30, 2014, 11:18:57 pm »
Ok, I did more research and read over the link but I believed the author assumed that I had ".a" files for my library which I don't. Does anybody else have experience with makefile or command line compiling on windows for sfml?

10
General / Re: Compile Project on Windows Via Cmd
« on: April 30, 2014, 09:03:28 pm »
I read over the tutorials section for sfml 2.1 and most of the stuff seems to be for IDE's, with the exception of the linux tutorials. Where might I find relevant content for command line based compiling and linking for Windows?

11
General / Compile Project on Windows Via Cmd
« on: April 30, 2014, 08:25:07 pm »
I've got a simple file "main.cpp" seen below. I also have all the sfml 2.1 libraries under "C:\SFML-2.1\". My question is: What are the commands to compile, link, and run this project? I'm very comfortable using gcc to compile projects from the command line, but have never done so with any external libraries (such as sfml) before. Any help would be greatly appreciated. Thanks.

#include <SFML/Window.hpp>

int main()
{
    sf::Window window(sf::VideoMode(800, 600), "My window");

    // run the program as long as the window is open
    while (window.isOpen())
    {
        // check all the window's events that were triggered since the last iteration of the loop
        sf::Event event;
        while (window.pollEvent(event))
        {
            // "close requested" event: we close the window
            if (event.type == sf::Event::Closed)
                window.close();
        }
    }

    return 0;
}
 

Pages: [1]
anything