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

Author Topic: Help! Wierd output without errors building on Linux - 32bit.  (Read 2014 times)

0 Members and 1 Guest are viewing this topic.

BlueParagon

  • Newbie
  • *
  • Posts: 6
    • View Profile
Help! Wierd output without errors building on Linux - 32bit.
« 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!
« Last Edit: April 17, 2016, 05:38:10 pm by BlueParagon »

jcowgill

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Help! Wierd output without errors building on Linux - 32bit.
« Reply #1 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

  • You are passing -c to g++. This causes g++ to output object files instead of executables.
  • The < and > characters are not passed to g++, they are special characters interpreted by your shell to perform redirection (write output of a command to a file). This is where your empty "-lsfml-graphics" file came from.
  • If you are using the repositories of your distro, the sfml libraries are probably already by in your linker path so the -L option isn't needed at all.

In any case, re-read this page again:
http://www.sfml-dev.org/tutorials/2.3/start-linux.php

BlueParagon

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Help! Wierd output without errors building on Linux - 32bit.
« Reply #2 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!!

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Help! Wierd output without errors building on Linux - 32bit.
« Reply #3 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

BlueParagon

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Help! Wierd output without errors building on Linux - 32bit.
« Reply #4 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!!

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
AW: Help! Wierd output without errors building on Linux - 32bit.
« Reply #5 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/