SFML community forums

Help => General => Topic started by: BlueParagon on April 17, 2016, 05:29:39 pm

Title: Help! Wierd output without errors building on Linux - 32bit.
Post by: BlueParagon on April 17, 2016, 05:29:39 pm
Wow its been a long road to get even to here. I hope I posted this in the right place?

I've tried installing SFML in just about every way possible on my 32bit computer with Linux.. I've tried building from the souce code (too many errors for me to deal with in cmake) to installing piece by piece, and several times just through the repositories.

I ended up almost getting it to work simply going through the repositories, and re-reading the offical manual. So GCC seems to compile from the command line now, without errors. By typeing in this...

g++ -c sfmltest.cpp -o sfml.app -L</user/include/SFML> -lsfml-graphics -lsfml-window -lsfml-system

It doesn't throw up any error codes, and outputs something... However it produces two files everytime I do this... One file is called -lsfml-graphics and the other is sfml-app. Neither one is executible. My 32bit Linux doesn't even know what to do with the sfml-app. If I double click on it, Linux asks for an application to open "Object Code" files. If I open the app file in nano, it says (Converted from Mac format) Strangely when I open the -lsfml-graphics file, its just empty with no code or anything.

Could one of the library files be mixed up for a Mac instead of for my 32bit Linux in the repositories or something? I mean that's impossible right? It wouldn't even compile at all. How the heck is it outputting a Mac format. I'm half tempted to put the file on a usb stick on see if it'll run on my Mac.

I feel like I'm so close to getting some SFML code to compile correctly, but I'm still not quite there yet? Does anyone have any idea what's going on here? I noticed that the downloads for SFML for a 32 bit Linux mentioned that its trickier, but can be done?

Thanks in advance... I'd be so happy if I could get this to work!
Title: Re: Help! Wierd output without errors building on Linux - 32bit.
Post by: jcowgill on April 17, 2016, 06:03:15 pm
g++ -c sfmltest.cpp -o sfml.app -L</user/include/SFML> -lsfml-graphics -lsfml-window -lsfml-system

There are a number of problems with this command. Try this instead:
g++ sfmltest.cpp -o sfml.app -lsfml-graphics -lsfml-window -lsfml-system


In any case, re-read this page again:
http://www.sfml-dev.org/tutorials/2.3/start-linux.php (http://www.sfml-dev.org/tutorials/2.3/start-linux.php)
Title: Re: Help! Wierd output without errors building on Linux - 32bit.
Post by: BlueParagon on April 17, 2016, 06:19:16 pm
YYEEESSSS! It worked perfectly! Finally... I've been trying to get SFML to compile correctly for about 14 hours over two days... Turns out it was simple, and I shouldn't have tried all the other stuff. Thak you Sooooo much jcowgill! I was starting to go crazy there ! Now I can actually start makin stuff... Might save setting up the linkers in CodeBlocks for another day... For now just gonna play around with what works! Thanks again!!
Title: Re: Help! Wierd output without errors building on Linux - 32bit.
Post by: eXpl0it3r on April 17, 2016, 06:47:21 pm
It can be very helpful to learn what the command line options for GCC means. That way you won't have to try random things, but actually know what should happen when you use it.
Title: Re: Help! Wierd output without errors building on Linux - 32bit.
Post by: BlueParagon on April 17, 2016, 07:33:47 pm
@eXpl0it3r- I completely agree! I know some of the abbreviations, -o for output... I was thinking -c was for compile for some reason. I have some stuff memorized in Linux, mostly just certain commands I use everyday... Other than that I end up usually having to google it, or else check my little black book of Linux/C++ notations. Anything I fine noteworthy, goes in there... This line jcowgill showed me is already written down now! lol. I'm pretty good with learning new things with computers, just wish I had a photographic memory!!
Title: AW: Help! Wierd output without errors building on Linux - 32bit.
Post by: eXpl0it3r on April 17, 2016, 07:44:53 pm
You also get the man pages on Linux.

IIRC -c does mean compiling, but that produces object files not executables. These object files then need to be linked together and also link in libraries and you end up with an executable. ;)
If you don't specify -c compiling and linking (building) will happen in one step.