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

Author Topic: Need HOWTO tutorial for setup SMFL with eclipse CDT  (Read 27058 times)

0 Members and 1 Guest are viewing this topic.

Ard

  • Newbie
  • *
  • Posts: 1
    • View Profile
Need HOWTO tutorial for setup SMFL with eclipse CDT
« on: March 01, 2010, 06:38:56 pm »
Hello!
I will be very grateful if somebody can describe this subject!

Krosan

  • Newbie
  • *
  • Posts: 10
    • View Profile
Need HOWTO tutorial for setup SMFL with eclipse CDT
« Reply #1 on: March 01, 2010, 08:41:58 pm »
compiler?

at linux gcc -> like descripted here Installing SFML  http://www.sfml-dev.org/tutorials/1.5/start-linux.php

+ libary settings in eclipse
sfml-graphics
sfml-window
sfml-system

cu

bryanww

  • Newbie
  • *
  • Posts: 2
    • View Profile
HOWTO tutorial to setup SMFL with Eclipse CDT
« Reply #2 on: February 14, 2011, 12:35:17 am »
This is long after the OP, but I just successfully set up Eclipse to compile and run the SFML hello world example on WinXP.  I think it would be a great idea to post the tutorial; I'm a professional Java developer so I eat, drink, and breathe Eclipse, meaning that for people like me, Eclipse CDT + SFML is an ideal solution for cross-platform game development.  Why?  Because I can leverage my existing knowledge of Java to manipulate assets (tools and editors).

Basically, I followed the installation how-to for the Code::Blocks IDE since Eclipse CDT also uses MinGW (by recommendation).  The install is perfectly analogous (almost one-to-one), and I had it running in several minutes.  I then tried installing Code::Blocks since it looks very interesting.  Once finished, I can now edit the same source code simultaneously in both IDEs (the project files do not conflict and the default output dirs also do not conflict).  It was so refreshing to have this work so cleanly out of the box that I wanted to share my steps.  Note that it's still important to have a good understanding of the concepts of search paths, compiling, and linking.

How-To Run SFML in Eclipse CDT (Windows, but *nix is similar)

Install the MinGW compiler and set up operating system PATH (Windows Only):
  • 1.  Install MinGW.  Note that the stable version of MinGW runs gcc 3.4.5, and SFML was built with 4.4, so you need a build that comes with gcc 4.4; a link to a compatible MinGW is provided in the Code::Blocks install tutorial.
  • 2.  Download and install MSYS from the MinGW site.  MSYS contains windows command-line utilities (e.g. "make") that supplement MinGW.
  • 3.  Add the MinGW and MSYS bin dirs to your system PATH.  The dirs you need to add are typically "C:\MinGW\bin" and "C:\msys\1.0\bin" (don't forget that windows uses semi-colons as delimiters, e.g.:  "...;C:\MinGW\bin;C:\msys\1.0\bin").

Install Eclipse IDE and the CDT plugin (for C++ development):
  • 4.  Download/install the Java runtime (JRE).  Eclipse runs using native SWT components under Java.
  • 5.  Download the Eclipse IDE and unpack into "C:\Program Files" or similar dir (no install :D ).
  • 6.  Download the latest Eclipse CDT archive file for C++ development (the authors provide a direct link in the CDT download website; they mention a bug in the repository related to the debugger).
  • 7.  Run Eclipse, and go to Help > Install New Software... > Add...  Then, under the Add Repository dialog, select Archive... and open the "cdt-master" zipped archive.  Give it a name like "CDT archive" and add.  Under Work With, select the "CDT archive" from the drop-down, and check off "CDT Main Features" and "CDT Optional Features".  Hit next and finish installation.
  • 8.  At this point, Eclipse is ready to build SFML projects as long as your path is setup correctly.  Test on the command-line by typing "g++" and "make", both should run but not do anything because there's no targets.

Build and Run the Hello World Program:
  • 9.  In Eclipse, select File > New > C++ Project.  Enter a project name such as "SFMLHelloWorld".  Under Project type: select "Executable" and "Hello World C++ Project", and under Toolchains: select "MinGW GCC".  Press Finish, which creates the project, including Debug and Release configurations.
  • 10.  Replace the content of "SFMLHelloWorld.cpp" with the example program from the Code::Blocks tutorial.  Before we can build it, we need to tell the project where to find the SFML header files (include), and what libraries to link to when building (lib).
  • 11.  By default, the Debug configuration will be selected as the Active configuration; we will edit the settings for this configuration first.  In the Project Explorer, Right-click on "SFMLHelloWorld" and select Properties.  In the properties dialog, select C/C++ Build > Settings > Tool Settings.  This is where you configure your project for search paths, library linking, and other options.  Starting top to bottom, the first thing you probably want to do is to define the SFML_DYNAMIC macro (this is for dynamic library linking, e.g. DLLs, don't do this if you are going to perform static linking).  Under GCC C++ Compiler > Preprocessor, click the "plus/add" icon under Defined symbols (-D) and add "SFML_DYNAMIC" (see image).



  • 12.  Include the SFML header files on the search path.  Under GCC C++ Compiler > Includes, click the "plus/add" icon under Include paths (-I) and add "C:\proj\lib\SFML-1.6\include" where "C:\proj\lib\SFML-1.6" is the path of your SFML installation (see image).



  • 13.  Tell the Linker where to find the SFML libraries.  Under MinGW C++ Linker > Libraries, click the "plus/add" icon under Libraries (-l) and add "sfml-system-d".  NOTE: this is the debug SFML system library; add this library if you are editing your debug configuration (as shown in the image).  You can toggle between debug/release configurations at the top of this dialog under Configuration:.  If this configuration is the release configuration, use the release library ("sfml-system").  You can optionally add the other libraries as shown.  Note that the linking order matters (as explained in the Code::Blocks tutorial).



  • 14.  Add the lib dir to the library search path.  Under MinGW C++ Linker > Libraries, click the "plus/add" icon under Library search path (-L) and add "C:\proj\lib\SFML-1.6\lib", again, where "C:\proj\lib\SFML-1.6" is the path of your SFML installation (see image).
  • 15.  Hit Apply to save changes.  Perform steps 11 to 14 once more for the Release configuration by first selecting "Release" under Configuration:.
  • 16.  In the code editor, press ctrl+B to build the program.  Run it by going to Project Explorer > SFMLHelloWorld > Binaries, right-click on "SFMLHelloWorld.exe" and select Run As > Local C/C++ Application.
That should be it!  Hopefully this is helpful.  I think this is enough to post under the tutorials; if Laurent would feel so inclined, please feel free to add-to/repost as another installation tutorial.

Cheers,
Bryan

Jayzan

  • Newbie
  • *
  • Posts: 8
    • View Profile
portable?
« Reply #3 on: June 18, 2011, 06:02:03 pm »
Does anyone know if this will work with eclipse like this but from a usb drive?   I would like to use sfml, but since I'm often changing computers I like to use a usb flash drive to manipulate my code from the usb drive.

bryanww

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: portable?
« Reply #4 on: July 26, 2011, 02:45:27 am »
Quote from: "Jayzan"
Does anyone know if this will work with eclipse like this but from a usb drive?   I would like to use sfml, but since I'm often changing computers I like to use a usb flash drive to manipulate my code from the usb drive.


Yes it works really well if you merge your code.  Eclipse stores all of the important metadata in .project and .cproject.  I started collecting all of my resources on an external hard drive because I work on several machines.

I ran into this problem:  I'm working on Linux but my external drive is NTFS.  I keep it this way so I can work on Windows as well.  I couldn't build and run off the external drive because NTFS obviously lacks ext3 (or similar) permissions.  My distro disables execute privileges on ext3 by default.  So instead of trying to change it, I merge my source code between machine and external drive using Gnome Commander.  This is similar to what I do at work to make backups (to complement SVN), where I use Total Commander (Windows).  This setup works really well for me.

Quillraven

  • Newbie
  • *
  • Posts: 11
    • View Profile
Need HOWTO tutorial for setup SMFL with eclipse CDT
« Reply #5 on: September 16, 2011, 09:05:32 am »
thx for the tutorial, helped me a lot.

however i have 3 questions:
1) when i start the exe from eclipse, it doesn't really do anything. when i start it from the windows folder it works like a charm. can i change something to run it correctly from eclipse?

2) i hadn't to download mysy. i just downloaded the newest mingw and had to change 2 things in the bin folder of mingw. a) rename mingw32-make (or sthg like that) to just make and b) create a rm.bat file (or was is rn.bat?) with the following code: del all $* (or sthg like that. sorry cant remember the code exactly because i'm not at home right now to open the file).

3) when i create a sourcefolder and switch the "main.cpp" into it, i have to delete this autogenerated Default folder, where the binaries and exe file are in, and also i have to readd the library search folder and the libraries (sfml-system-d....). why is that?


regards
simon

 

anything