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

Author Topic: Can't get even an example program to run  (Read 2887 times)

0 Members and 1 Guest are viewing this topic.

7cardcha

  • Newbie
  • *
  • Posts: 3
    • View Profile
Can't get even an example program to run
« on: August 13, 2012, 09:00:31 pm »
I have codeblocks 10.05 and Windows 7 Home Premium 64bit.

I defined SFML_DYNAMIC and put

-lsfml-system
-lsfml-window
-lsfml-graphics
-lsfml-network
-lsfml-audio
-lopengl32
-lglu32

In the linker settings.


and added C:\Program Files (x86)\CodeBlocks\SFML\include to  Search directories -> compiler and added


C:\Program Files (x86)\CodeBlocks\SFML\lib to Search directories -> linker.


I then put all the dll's in the project folder and built and run this example.


#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;
}
 

All I get is program.exe has stopped working.

I searched this on google first.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10819
    • View Profile
    • development blog
    • Email
Re: Can't get even an example program to run
« Reply #1 on: August 13, 2012, 10:36:07 pm »
I've no idea why it doesn't work but I'd suggest you to use SFML 2. ;)

Do you get that error as soon as you start the application or only after a while? Does it happen when you run it from inside Code::Blocks or also when you just double click the exe file? Do you get any warnings when compiling? Can you set a break point in your source somewhere and let the debugger jump in at that position or does it crash before reaching the breakpoint?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

7cardcha

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Can't get even an example program to run
« Reply #2 on: August 13, 2012, 11:13:12 pm »
It takes like .7 seconds to crash. Doesn't matter if I run it in codeblocks or not. No compile warnings. I'll try some of your suggestions as soon as I have time. Thanks.
« Last Edit: August 13, 2012, 11:57:02 pm by 7cardcha »

7cardcha

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Can't get even an example program to run
« Reply #3 on: August 14, 2012, 01:58:32 am »
With the same code here is the gdb debug.


C:\Users\Charles\Documents\SFML\bin\Release>gdb SFML.exe
GNU gdb (GDB) 7.4
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from C:\Users\Charles\Documents\SFML\bin\Release\SFML.exe...(no
debugging symbols found)...done.
(gdb) run
Starting program: C:\Users\Charles\Documents\SFML\bin\Release\SFML.exe
[New Thread 4588.0x1704]

Program received signal SIGSEGV, Segmentation fault.
0x6630373e in sf::Clock::Clock() ()
   from C:\Users\Charles\Documents\SFML\bin\Release\sfml-system.dll
(gdb)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10819
    • View Profile
    • development blog
    • Email
Re: Can't get even an example program to run
« Reply #4 on: August 14, 2012, 02:01:35 am »
You should not mix debug (sfml-xyz-d.so) and release (sfml-xyz.so) libraries. ;)

And I still advice you to use SFML 2. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

lrx

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: Can't get even an example program to run
« Reply #5 on: August 14, 2012, 11:17:21 pm »
isn't that wrong linking order btw? I believe it should be:
-graphics
-network
-window
-system

Correct me if I'm wrong