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

Author Topic: Using SFML without any IDE  (Read 4916 times)

0 Members and 1 Guest are viewing this topic.

pinky

  • Newbie
  • *
  • Posts: 3
    • View Profile
Using SFML without any IDE
« on: May 21, 2014, 11:39:01 pm »
My question is that with this compiler that I have which I've downloaded it long time ago and I remember just the downloading it was a nightmare, can I compile this piece of code from SFML & Code::blocks tutorial and If yes what the heck is the compile command?

If you need to know more about the compiler tell me what is it so I can get it for you, I don't know much about this sort of stuff.

It'll save me from embarrassment and you from wasting your time, If I don't mention the things I've tried and didn't work out.

Compiler info:



code from SFML and Code::Blocks Tutorial:


address and version of SFML:

dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog
Re: Using SFML without any IDE
« Reply #1 on: May 22, 2014, 12:34:43 am »
To learn commands for the compiler, run g++ --help.
Or read this page.

An IDE is essentially a wrapper around the compiler.

pinky

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Using SFML without any IDE
« Reply #2 on: May 22, 2014, 01:53:44 am »
Can't you just tell the command for this situation? but I guess It's better If I list what I've tried, maybe that'll clearify what is it that I'm looking for:

Keep in mind I know nothing about compiling layout and structure, linker, preprocessing, object files etc.

g++ SFML.cpp -o test



g++ SMFL.cpp -o test -I D:\SFML\include


g++ SFML.cpp -o test -I D:\SFML\include -lD:\SFML\lib\libsfml-graphics.a -lD:\SFML\lib\libsfml-window.a -lD:\SFML\lib\libsfml-system.a


g++ SFML.cpp -o test -I D:\SFML\include -L D:\SFML\lib -lD:\SFML\lib\libsfml-graphics.a -lD:\SFML\lib\libsfml-window.a -lD:\SFML\lib\libsfml-system.a

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: Using SFML without any IDE
« Reply #3 on: May 22, 2014, 02:16:36 am »
Take a look at the SFML and Linux tutorial, it shows how to compile an SFML program. (I know you're on windows but it should be the same)
There's 2 steps : compiling the cpp, then linking.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: Using SFML without any IDE
« Reply #4 on: May 22, 2014, 08:06:56 am »
You need to tell where the libs are with -L and then you only need provide the name of the lib with -l (e.g. -L path/to/sfml -lsfml-graphics -lsfml-window -lsfml-system)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Using SFML without any IDE
« Reply #5 on: May 22, 2014, 08:31:34 am »
If your project grows to more than one file (or even just the one), I'd recommend driving the build with something like SCons, CMake, make or a similar build tool instead of manually typing in build commands all the time.
Personally I recommend SCons.

pinky

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Using SFML without any IDE
« Reply #6 on: May 23, 2014, 08:38:41 pm »
Linking statically didn't work :
g++ SFML.cpp -o test -I D:\SFML\include -L D:\SFML\lib -lsfml-graphics-s -lsfml-window-s -lsfml-system-s



But dynamically worked ! (although it needed: "-I D:\SFML\include" as well and wouldn't work without it) :
g++ SFML.cpp -o test -I D:\SFML\include -L D:\SFML\lib -lsfml-graphics -lsfml-window -lsfml-system



It required these 2 files from MinGW bin folder:
libgcc_s_dw2-1.dll
libstdc++-6.dll
as well as dll files from SFML\bin folder
« Last Edit: May 23, 2014, 08:42:29 pm by pinky »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: Using SFML without any IDE
« Reply #7 on: May 23, 2014, 09:23:35 pm »
For static linking you need -DSFML_STATIC and if SFML is built from a git version, you'll also see the FAQ on static linking.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/