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 - meddlingwithfire

Pages: [1]
1
Window / Re: RenderWindow not appearing?
« on: November 17, 2012, 07:38:48 pm »
Thanks for the hints, guys!  I've switched to using the SFML 2.0 RC build, and that's solved my problem.  Now I can get down to the fun stuff.

@cire -- Sorry, I definitely missed those.  I'll spend more time searching next round.

2
Window / RenderWindow not appearing?
« on: November 11, 2012, 11:49:06 pm »
I am attempting to follow a video tutorial, and I've run into an strange runtime issue. 

I have my project set up, I and am able to compile and run.  But I am not able to see the RenderWindow on my screen.  All I can see is an empty console window pop up.  No compile errors and no linker errors are mentioned in the build log.  What am I missing?

I am trying to follow along at 6:14 location in the tutorial below:


In the video at 6:14, you can see he has two windows open: the black console window, and another blue-ish window (which I assume is the RenderWindow).  When I build and run, I see the black console window, but the blue window never appears.

Environment:
Windows 7 Professional 64-bit
Code::Blocks + MinGW
SFML 1.6, dynamically linked

I do have an ATI video card - I've heard that ATI doesn't play well with SFML, but I haven't seen any specific references to my issue in regards to ATI.

Here's the code I am trying to run:
Code: [Select]
#include <SFML/Graphics.hpp>

int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600, 32), "SFML Sample Application");

while(window.IsOpened())
{
sf::Event event;
while(window.GetEvent(event))
{
switch(event.Type)
{
case sf::Event::Closed:
window.Close();
break;
}
}

window.Clear();
window.Display();
}

return 0;
}

Any ideas?

3
Figured it out!  I thought it would be something stupid, and it was. 

I was linking against the the wrong library build.  I had originally downloaded the Visual Studio C++ build of SFML, as I was going to get things up and running in that environment.  But when I switched over to Code::Blocks+MinGW, I didn't re-download the proper development files, I had just re-used the Visual Studio build files.  As soon as I grabbed the MinGW files and set them up in Code::Blocks, the linker was happy.

4
I am having trouble completing the tutorial to set up SFML 1.6 with CodeBlocks+MinGW (http://www.sfml-dev.org/tutorials/1.6/start-cb.php).  Specifically, when I build the project I get the following build log:

Quote
-------------- Build: Debug in sfmlTest ---------------

Compiling: main.cpp
Linking console executable: bin\Debug\sfmlTest.exe
obj\Debug\main.o: In function `main':
C:/Dev/codeBlocksTest/sfmlTest/main.cpp:6: undefined reference to `_imp___ZN2sf5ClockC1Ev'
C:/Dev/codeBlocksTest/sfmlTest/main.cpp:9: undefined reference to `_imp___ZNK2sf5Clock14GetElapsedTimeEv'
C:/Dev/codeBlocksTest/sfmlTest/main.cpp:10: undefined reference to `_imp___ZN2sf5SleepEf'
C:/Dev/codeBlocksTest/sfmlTest/main.cpp:7: undefined reference to `_imp___ZNK2sf5Clock14GetElapsedTimeEv'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
4 errors, 0 warnings

It looks like a problem with my linker configuration, but I've combed through the tutorial a dozen times now and I can't see what I am doing wrong or missing.  As far as I can tell, I am following the instructions to the letter.  I've set up the Global Compiler Settings >> Search Directory >> Compiler and Linker to point to the appropriate SFML include and lib directories.  I've updated my project build options (for both Debug & Release) to include the -lsfml-system library.  I've added the compiler SFML_DYNAMIC define as well (again, in both Debug & Release targets).  I have verified that all of the directory path settings are valid; I copy & pasted all of them into Windows Explorer to verify.  I also copy & pasted the code straight from the tutorial:

Code: [Select]
#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;
}

I searched around, and did see a couple people with similar issues:
http://en.sfml-dev.org/forums/index.php?topic=6900.msg45530#msg45530
http://www.cplusplus.com/forum/beginner/49533/

But their solutions have not resolved my errors.  I try a full Clean + Rebuild after each change I make as well.

I've verified that I am using the GCC 4.4 compiler:

Quote
C:\Program Files (x86)\CodeBlocks\MinGW\bin>gcc --version
gcc (TDM-2 mingw32) 4.4.1
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

For reference, here is my Code::Block .cbp project file:
Code: [Select]
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="sfmlTest" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="bin\Debug\sfmlTest" prefix_auto="1" extension_auto="1" />
<Option object_output="obj\Debug\" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-g" />
<Add option="-DSFML_DYNAMIC" />
</Compiler>
<Linker>
<Add option="-lsfml-system-d" />
</Linker>
</Target>
<Target title="Release">
<Option output="bin\Release\sfmlTest" prefix_auto="1" extension_auto="1" />
<Option object_output="obj\Release\" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
<Add option="-DSFML_DYNAMIC" />
</Compiler>
<Linker>
<Add option="-s" />
<Add option="-lsfml-system" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
<Add option="-fexceptions" />
</Compiler>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<envvars />
<debugger />
<lib_finder disable_auto="1" />
</Extensions>
</Project>
</CodeBlocks_project_file>

Thanks to everyone who takes a look.  If any further information would be helpful, just let me know, and I'll put together whatever I can.

Pages: [1]