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

Author Topic: Help with a simple question  (Read 1742 times)

0 Members and 1 Guest are viewing this topic.

acrazyplayer

  • Newbie
  • *
  • Posts: 6
    • View Profile
Help with a simple question
« on: March 11, 2011, 04:46:17 pm »
A little background first is needed.

I am using the 1.6  version of SFML on Ubuntu 10.10.

I am pretty new to c++ programming and very new to SFML,

I'm trying to learn SFML because I want my c++ RPG to have a lot more then just a terminal and some text.

What I would like to know is how to actually "use" SFML. I have tried the tutorials and they compile but I cant test or use what has been compiled, its this step I cant get passed. I have compiled other games that I found and they all work.

If you would kindly tell me what I'm missing, or just explain the steps required to make a working game/program then I would be very grateful. Thanks in advance.
the future has passed

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32261
    • View Profile
    • SFML's website
    • Email
Help with a simple question
« Reply #1 on: March 11, 2011, 06:36:27 pm »
Quote
I have tried the tutorials and they compile but I cant test or use what has been compiled

Ok but... Why? What's the problem?
Laurent Gomila - SFML developer

acrazyplayer

  • Newbie
  • *
  • Posts: 6
    • View Profile
Help with a simple question
« Reply #2 on: March 11, 2011, 07:18:28 pm »
The problem is I am left with a file like "main.o" that I have no idea how to use or test to see if it worked. Just because it compiled doesn't mean it will work the way its supposed to.

I just need to know what I'm supposed to do, for example.

"you need to write your code, include all the necessary headers and files, compile it and then...."

basically a very brief step by step until I have a finished product.

If there is a link or somewhere else on the fourms I can learn step by step then that would be great but everything just stops after the "compile the code"

with normal c++ for example I can write the code, click on build (in Geany) and then click execute to view whatever I just made but when I try with SFML I cant view anything after I compile my code.

I know this sounds really stupid but its just something I'm missing and I can't figure out
the future has passed

pdinklag

  • Sr. Member
  • ****
  • Posts: 330
  • JSFML Developer
    • View Profile
    • JSFML Website
Help with a simple question
« Reply #3 on: March 11, 2011, 07:26:37 pm »
Quote
"you need to write your code, include all the necessary headers and files, compile it and then...."

.... and then LINK! :)

This sounds like your application didn't get linked.
An object file (.o on Linux systems) is compiled code, but Linux won't know what to do with it until linked into an executable.

What do you compile with? I'm guessing GCC or G++. Tell it to link the output object files to an executable which you will be able to use. If you don't know how, try and check whether you have set anything about linking in your other projects that you could execute.
JSFML - The Java binding to SFML.

acrazyplayer

  • Newbie
  • *
  • Posts: 6
    • View Profile
Help with a simple question
« Reply #4 on: March 11, 2011, 07:31:47 pm »
I compile with the code "g++ -Wall -c"

that is what Geany uses by default and I see no reason to change it because it has worked thus far.

I will give linking a try, thanks for your answer! *I hope this works*
the future has passed

pdinklag

  • Sr. Member
  • ****
  • Posts: 330
  • JSFML Developer
    • View Profile
    • JSFML Website
Help with a simple question
« Reply #5 on: March 11, 2011, 07:39:56 pm »
Quote
g++ -Wall -c

Hehe. What -c does is tell GCC to not link, ie that's exactly what makes it not work. ;)

Try it without -c.

Use
Code: [Select]
g++ --help
to get a list of command line parameters and their explanations - its really of great help at times! And it's always good to know what stuff does.
JSFML - The Java binding to SFML.

acrazyplayer

  • Newbie
  • *
  • Posts: 6
    • View Profile
Help with a simple question
« Reply #6 on: March 11, 2011, 08:15:44 pm »
OK I got it working, thanks a lot pdinklag for your help!

I'm off to learn a heck-ov-a-lot more now...
the future has passed