SFML community forums
Help => General => Topic started by: zivkovic 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 !
-
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.
-
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
-
BUMP, I really need help with this.
-
BUMP
-
This is a very common problem for new C++ programmers, and not related to SFML.
The first chapter in this tutorial (http://www.cprogramming.com/tutorial.html) has an explanation, as well as a solution. :)
-
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.
-
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.
-
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.
-
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?
-
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 (http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers-includes-incubating-components/indigosr2).
-
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.
sfml-graphics-d
sfml-window-d
sfml-system-d
Can you try to link to sfml-system only?
-
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.
-
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)?
-
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?
-
You can put DLLs in any folder, as long as its path is added to the PATH environment variable. Standard paths such as C:\Windows\System32 or C:\Program Files are already in it.
-
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?
That's strange. On my Windows computer I get an error that the application couldn't start because of a missing DLL, and it even names the DLL. It doesn't matter if I compile with the Microsoft compiler or MinGW.
-
I know right. Thanks for all your help Laurent and others contributors.
-
Hi all.
For a first post in the sfml forums, I'm a little ashamed to exhume an old post... Well, It may help another lost user =)
If your executable instantly close (didn't run at all) it's probably cause it's missing some dlls. I guess your dlls are located near the exe cause windows can launch it properly. So why on earth eclipse can't find them ?
In fact you must configure the current directory of execution in the "Run/Run configuration..." pannels. The default one is probably not the one in which the dll (and exe) are located.
(http://i.imgur.com/6FYnchts.png) (http://imgur.com/6FYncht)