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

Author Topic: SFML gets terminated right away?  (Read 6150 times)

0 Members and 1 Guest are viewing this topic.

zivkovic

  • Newbie
  • *
  • Posts: 11
    • View Profile
SFML gets terminated right away?
« on: May 18, 2012, 06:52:46 pm »
Okay, I'm new to this and firts thing I encountered is this. No mater what sample program I choose, it never runs as it should.

I'm using Eclipse C/C++ CDT and SFML 1.6. And for the compiler im using mingW.

Here are my settings in Eclipse C++ :

http://screensnapr.com/v/rt2Spy.png
http://screensnapr.com/v/oqPWxg.png
http://screensnapr.com/v/31mNQT.png

And here is the example i tried:

Source file:
http://screensnapr.com/v/8nv3tn.png

Header file:
http://screensnapr.com/v/0uoX3u.png

And after I run the program it immediatly does this:
http://screensnapr.com/v/drKR2b.png

Id appreciate any help. Thanks !
« Last Edit: May 22, 2012, 10:19:54 am by Laurent »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SMFL gets terminated right away?
« Reply #1 on: May 18, 2012, 06:57:55 pm »
This program is not supposed to last long, it prints what it has to print to the console and returns.

So just make sure that the console stays open after the program returns so that you can see what's in it.
Laurent Gomila - SFML developer

zivkovic

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: SMFL gets terminated right away?
« Reply #2 on: May 18, 2012, 07:00:51 pm »
I tried, this is what i tried:
http://screensnapr.com/v/V2of0J.png

When I ran that it did the exact same thing. If I commented the Clock stuff(http://screensnapr.com/v/sxZZr3.png), it ran as it should, but when its uncommented it doesent print anything. Even if it terminates it should leave it open for me to click/view output.

EDIT:

Here, the "console printout":

http://screensnapr.com/v/6iNCsW.png
« Last Edit: May 18, 2012, 07:23:46 pm by zivkovic »

zivkovic

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: SMFL gets terminated right away?
« Reply #3 on: May 19, 2012, 11:13:48 pm »
BUMP, I really need help with this.

zivkovic

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: SMFL gets terminated right away?
« Reply #4 on: May 21, 2012, 11:24:23 pm »
BUMP

model76

  • Full Member
  • ***
  • Posts: 231
    • View Profile
Re: SMFL gets terminated right away?
« Reply #5 on: May 22, 2012, 01:14:15 am »
This is a very common problem for new C++ programmers, and not related to SFML.

The first chapter in this tutorial has an explanation, as well as a solution. :)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: SMFL gets terminated right away?
« Reply #6 on: May 22, 2012, 10:16:54 am »
This is a very common problem for new C++ programmers, and not related to SFML.

Which means, read a book about C++ and learn the language before you want to do crazy stuff with SFML. ;)
Also bumping posts isn't really apprecieated...

If you need help instantly there are always IRC C++ channels on quakenet, freenode etc.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML gets terminated right away?
« Reply #7 on: May 22, 2012, 10:23:43 am »
Quote
Also bumping posts isn't really apprecieated...
... by you ;)
I never officially said that bumps were disallowed or not appreciated. I'm personally ok with them as long as they are not overused.
Laurent Gomila - SFML developer

zivkovic

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: SFML gets terminated right away?
« Reply #8 on: May 22, 2012, 10:30:29 am »
Im quite experienced with c and a bit less with c++, the problem is the program never actually starts, it builds and terminates instantly., i have "system("PAUSE"); in the code, so it should stop for me to press a key, but this option never appears.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML gets terminated right away?
« Reply #9 on: May 22, 2012, 10:34:09 am »
Is the console activated in your project settings?

Can you reach the first line of main() if you execute the code step by step with the debugger?

Do you link to sfml-system only, or to other modules?
Laurent Gomila - SFML developer

zivkovic

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: SFML gets terminated right away?
« Reply #10 on: May 22, 2012, 02:31:46 pm »
In Eclipse, console is always activated, im trying to run it thru the debugger, so that would be no. And im linking this three:

sfml-graphics-d
sfml-window-d
sfml-system-d

In the exact order as posted here. If u want u can try Eclipse C/C++ and add it yourself. You can get it here: http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers-includes-incubating-components/indigosr2.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML gets terminated right away?
« Reply #11 on: May 22, 2012, 02:42:34 pm »
Quote
im trying to run it thru the debugger, so that would be no
But the debugger doesn't run step by step by default, you must either do it explicitely or put a breakpoint on the first line.

Quote
sfml-graphics-d
sfml-window-d
sfml-system-d
Can you try to link to sfml-system only?
Laurent Gomila - SFML developer

zivkovic

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: SFML gets terminated right away?
« Reply #12 on: May 22, 2012, 04:26:27 pm »
I had many brakepoints and use the built-in debugger, but still it just starts and terminates instantly.
Also as u suggested I only used sfml-system link, but that did not work aswell. If u want to u can see the situation on my computer, check ur PM for details.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML gets terminated right away?
« Reply #13 on: May 22, 2012, 04:35:14 pm »
Have you tried to run the executable directly from a console (not from Eclipse)?

Are you sure that sfml-system.dll is found when you run the program (ie. it should be in the same directory as the executable)?
Laurent Gomila - SFML developer

zivkovic

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: SFML gets terminated right away?
« Reply #14 on: May 22, 2012, 04:57:57 pm »
It is found but only if i start it thru eclipse. Now i copyed the sfml-system.dll to the folder where executable file is and ran it by double clicking on it. It worked, i tested on eclipse while the dll was in the same folder and again it worked. Soo is this the only option, to put the dll's into the same folder as executable, or can i load them from a different folder?

 

anything