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

Author Topic: Setting up C++11 SFML in Eclipse for windows Tutorial  (Read 13938 times)

0 Members and 1 Guest are viewing this topic.

Critkeeper

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
Setting up C++11 SFML in Eclipse for windows Tutorial
« on: March 10, 2015, 10:50:33 am »
Step 0:

Install TDM MinGW for windows
http://tdm-gcc.tdragon.net/download
Rather than installing it with the default directory name, save it in a new directory named MinGW, since eclipse will look for that exact name.

Step 1:

Do you have luna eclipse already installed? If not, go to step 2a, otherwise go to step 2b.

Step 2a:

https://eclipse.org/downloads/
Select the 64 bit version eclipse ide for c/c++ development
go to step 3.

Step 2b:

Do you have c++ development tools already installed in eclipse? If not, go to step 2c, otherwise go to step 3.

Step 2c:

Go to help -> install new software -> Work with luna -> Programming languages
check C/C++ Development tools and C/C++ Library API Documentation Hover Help
go to step 3.

Step 3:

http://www.sfml-dev.org/download/sfml/2.2/
download GCC 4.8.1 TDM (SJLJ) - 32-bit and save it

Step 4:

Start eclipse, use the default workspace or your own specific if you have made one.

File -> New -> Project -> C++ -> C++ Project

Name it "SFML_CPP11_Template"

Step 5:

Right click the Project int he Project explorer and go to properties, then go to C/C++ Build -> Settings
Choose [All configurations]

Step 6:

GCC C++ Compiler -> Dialiect -> language standard -> ISO C++11 (-stc=c++0x)

Step 7:

GCC C++ Compiler -> Preprocessor -> Defined symbols
add the following:
SFML_STATIC
__GX_EXPERIMENTAL_CXX_0X__
_cplusplus=201103L

Step 8:

GCC C++ Compiler -> Includes -> Include paths
Let the path to where you saved the SFML library be called "path", then you would add the following:
path\include
so for example if you saved it in C:\Users\User\Documents\
it would be:
C:\Users\User\Documents\SFML-2.2\include

Step 9:

change the configuration to debug configuration

MinGW C++ Linker -> Libraries -> Library search path
add the same thing you added in step 8 except instead of \include add \lib

add the following, in this exact order, to Libraries

sfml-graphics-s-d
freetype
glew
jpeg
sfml-window-s-d
opengl32
gdi32
sfml-audio-s-d
sndfile
openal32
sfml-network-s-d
ws2_32
sfml-system-s-d
winmm

Step 10:

change the configuration to release configuration

MinGW C++ Linker -> Libraries -> Library search path
add the same thing you added in step 8 except instead of \include add \lib

add the following, in this exact order, to Libraries

sfml-graphics-s
freetype
glew
jpeg
sfml-window-s
opengl32
gdi32
sfml-audio-s
sndfile
openal32
sfml-network-s
ws2_32
sfml-system-s
winmm


Step 11:

Save the project and copy / paste it from the workspace to somewhere safe.
Any time you want to make a new SFML C++11 project with eclipse you can copy / paste this template and rename the project, and then start with a working empty slate.



EDIT:

I tried reproducing the exact steps in this thread on another computer and I had problems. I revised the steps in order to make it successful on both computers. It would help me greatly if you could do these steps (even if you don't intend to use sfml in eclipse) so I can understand whether it is reliable as is, or whether it needs to be changed again.
« Last Edit: March 10, 2015, 03:53:32 pm by Critkeeper »
if(CritKeeper.askQuestion()){return question.why();}

SLC

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Setting up C++11 SFML in Eclipse for windows Tutorial
« Reply #1 on: March 13, 2015, 06:00:51 pm »
I've always had trouble with TDM GCC so I've stopped using it. Don't know why but some libraries just failed to compile. Instead I've started using MinGW-w64. I never had any issues with that. The only downside is that `-static-libstdc++` and `-static-libgcc` have no effect. You still have to distribute your application with some of their dlls.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: Re: Setting up C++11 SFML in Eclipse for windows Tutorial
« Reply #2 on: March 13, 2015, 06:55:35 pm »
The only downside is that `-static-libstdc++` and `-static-libgcc` have no effect. You still have to distribute your application with some of their dlls.
You just need to link all of the runtime libs statically. The easiest way is to just use -static.

And yes, don't use TDM compilers.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything