Author Topic: eclipse  (Read 2931 times)

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
eclipse
« on: 23 January 2009, 12:31:16 »
I also want to start doing something in the code too but for now I have to learn somthing about C++ and Eclipse....
I already successfully made some changes ( just for me, just for testing ) and I added an new CPU player which is a bit stronger than the current CPU-Ultra for example.

I still have huge problems setting up the all things in eclipse correctly.
For example includes:
I put the whole glest source directory into a source folder. He does find all external includes like sdl and so on, but he doesn't find the includes in other subdirectories. How can I add the includes from the source folder(and its subdirectories) to the includepath in eclipse?
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

modman

  • Guest
Re: eclipse
« Reply #1 on: 23 January 2009, 22:43:42 »
The AI interests me.  How did you make it stronger?  The same way the Ultra is made stronger over the CPU? :(

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: eclipse
« Reply #2 on: 24 January 2009, 00:02:54 »
I downloaded the "Eclipse IDE for C/C++ Developers with Mylyn integration". To add include directories right click on the project, click properties, expand c/c++ general, go to paths and symbols. Click the add button (I'm not sure if the languages on the left make a difference).

For shared_lib project you add each directory (including sub-directories) in shared_lib and only the platform specific ones in platform (ie win32 or sdl). For game (or glest_game) project you add the same ones as shared_lib and also each directory in game.

Also need to add libraries so links correctly (it's along the same tab bar as Includes).
« Last Edit: 24 January 2009, 00:06:46 by hailstone »
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: eclipse
« Reply #3 on: 24 January 2009, 01:27:17 »
I simply use eclipse +the plugin for C/C++ Developers but it should be the same.
But I cannot find the "paths and symbols" entry.

I do the following:
I click right on the project
I click properties

Now i see this:


and now?
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: eclipse
« Reply #4 on: 24 January 2009, 01:38:08 »
I don't know what I made , but now it looks ok insight eclipse...( no more errors and it finds includes! )
I think I have to setup a build configuration now, or do you use the original jam configuration?
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: eclipse
« Reply #5 on: 25 January 2009, 11:28:19 »
My eclipse looks different to yours but I think "Directories" as you have highlighted is right. So now if you've compiled it properly (does no errors mean you've compiled it successfully?) it should have created a binary file. You need to copy this to the location with the Glest data files and try run it.

You could play with the build configuration but I think it should be ok as it is. Eclipse uses make, jam is a different build system.
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: eclipse
« Reply #6 on: 25 January 2009, 22:38:51 »
ok, now its nearly working, but I have the following problems:

1.--------------------------------    
in sources/platform/posix/socket.cc in this line:
....
int err= ioctl(sock, FIONREAD, &size);
....
I get the following errors:
error ioctl was not declared in this scope
error FIONREAD was not declared in this scope

But this error is only shown in the code, not under "Problems" from the compile.

2.-------------------------------------
in source/shared_lib/include/graphics/graohics_interface.h
....
class Context;
....

I get an error :
Forward declaration of 'struct Shared::Graphics::Context'

3.---------------------------------------
source/shared_lib/include/graphics/font.h
is marked with an error icon, but there is no error in it !?!

4.------------------------------------------
What do I do with all windows related code?
Its annoying to see errors in there?
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: eclipse
« Reply #7 on: 28 January 2009, 23:33:46 »
Ignore all errors not given by the compiler. If you're on a non-Windows OS you should not include the Windows files in the project (the files in platform/win32).

Is that the exact error you get about the forward declaration?
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

daniel.santos

  • Guest
Re: eclipse
« Reply #8 on: 29 January 2009, 02:44:03 »
I haven't used Eclipse for a C or C++ project in over a year, and I never used it that much to begin with, so I'm not too savy on it.  I'll try to get it set up and give it a go later on.  However, the IDE attempts to determine problems with your code before you compile it and if that fails, it reports those errors.  Probabaly, the way to eliminate that (if you are on linux) is to add /usr/include to your includes or something (it's defined in sys/ioctl.h, which usually includes bits/ioctl.h and/or asm/ioctl.h).  You may be able to configure Eclipse to use jam instead of make, but I think the current jam build system lacks the ability to compile source files individually (or I haven't figured out what to tell it to do that yet).  Either way, I run jam with -gj5, the -g tells it to compile the most recently modified source files first and the -j5 tells it to run 5 processes at once, so compilation is faster.  make will also accept -jx (where x is a number).

As for the rest of the errors, that's been a long standing issue with Eclipse in my experience.  It's a matter of telling the IDE all of the information that your build system also uses, so they have the same information and don't flag problems that aren't real.  I'm glad that you got it compiling though!  As I mentioned in the network code thread, I'll be a bit out of pocket for another week or so, after which I will attend the board a little better :)

titi

  • MegaGlest Team
  • Airship
  • ********
  • Posts: 4,240
    • View Profile
    • http://www.titusgames.de
Re: eclipse
« Reply #9 on: 29 January 2009, 09:10:05 »
What do you use to develop c++ ( glest? ) in Linux?
Emacs?? Thats what I used for c-development, but thats a really long time ago!

edit: ok now I know why I'm so disspointed of Eclipse/CDT. It's a ubuntu problem! Ubuntus repository contains CDT version 3.4.... but the current CDT version is 5.01. Ubuntus versions is from 2006/2007, unbelievable!
I think I have to setup the things again .....
« Last Edit: 29 January 2009, 10:00:54 by titi »
Try Megaglest! Improved Engine / New factions / New tilesets / New maps / New scenarios