Terminus Making the code portable to linux

From Bitpost wiki
Revision as of 02:16, 19 July 2006 by SquidBoy (talk | contribs)

world/bullet.hpp:23: error: type specifier omitted for parameter `szBullet'

To me this looks like it is not finding the Sint32 type in SDL_types.h? Either that or it is not finding my util/graph.h?

But hey, on the positive side, main.cpp and config.cpp have successfully compiled!  :>

Compiling craftselect.cpp... here's the full first error:

In file included from world/weapon.hpp:8,
                 from world/craft.hpp:11,
                 from craftselect.hpp:9,
                 from craftselect.cpp:5:
world/bullet.hpp:23: error: type specifier omitted for parameter `szBullet'
world/bullet.hpp: In member function `TeRect TeBullet::getBoundRect()':
world/bullet.hpp:236: error: request for member `CenteredAt' in `rclBullet',
   which is of non-aggregate type `const TeRect ()(TePoint (*)())'

"non-aggregate" apparently means the compiler doesn't think the return value from CenteredAt is a class or struct. It looks fine to me:

TeRect CenteredAt( TePoint pt ) const;

Lemme sleep on it, I'll give you an answer in the morning...

I emailed you the entire makefile generated by Dev-Cpp.

Here is the portion that applies to craftselect.cpp:

craftselect.o: craftselect.cpp craftselect.hpp util/gui.hpp
 util/graph.hpp util/fixmath.hpp util/text.hpp  util/image.hpp   
 util/element.hpp util/../system.hpp util/../util/log.hpp   util/../util/graph.hpp util/../config.hpp
 util/../xml/xmlutils.h   util/../xml/tinyxml.h util/../profile.hpp util/../util/audio.hpp
 util/../util/graph.hpp util/../xml/xmlutils.h util/blit.hpp   world/craft.hpp world/../gamedef.hpp
 world/../util/image.hpp   world/../util/smoke.hpp world/../util/element.hpp   world/../util/body.hpp
 world/../util/../system.hpp   world/../util/graph.hpp world/../util/fixmath.hpp world/weapon.hpp
 world/bullet.hpp world/../util/anim.hpp world/../util/blit.hpp   world/../util/audio.hpp
 world/../util/exhaust.hpp   world/../util/smoke.hpp world/../util/../gamedef.hpp
 world/../xml/xmlutils.h world/target.hpp world/../util/log.hpp   gamesys.hpp system.hpp
 game.hpp scene.hpp util/text.hpp   util/element.hpp mainmenu.hpp results.hpp world/capital.hpp
 world/block.hpp world/../util/body.hpp world/target.hpp   util/message.hpp world/event.hpp
 world/../util/graph.hpp $(CPP) -c craftselect.cpp -o craftselect.o $(CXXFLAGS)
 

where

CPP  = g++.exe -D__DEBUG__
CXXFLAGS = $(CXXINCS)   -fexceptions -g3
CXXINCS = 

I'm thinking it's a [const] issue... checking...


On the side, there is a new Windows demo available at http://soloforge.com/files/TerminusDemo.zip


Dang John! The content is BURSTING FORTH! This is fun stuff... like a graphic novel come to life...


Cool :-) Oh, the fighter melee tutorial is broken. The latest SVN version fixes it.


Trying to isolate the error in bullet.hpp...

cd terminus/terminus/world
cp bullet.hpp test.cpp
g++ -I/home/m/development/terminus/fmod/api -I/usr/include/SDL test.cpp

That does it. Now to play with test.cpp... OK, looks like g++ sees these and thinks they are function declarations:

const TeSize szBullet( nBulletW, nBulletH );
const TeRect rclBullet( TePoint(), szBullet );

Change to this and g++ "gets" it:

const TeSize szBullet = TeSize( nBulletW, nBulletH );
const TeRect rclBullet = TeRect( TePoint(), szBullet );

John, I hope you don't mind, I checked in that change, and one other similar change in world/craft.hpp. I want to be EXTREMELY careful about breaking anything of yours, can you see if it still works for you?

I am not on my home DEV station, so I cannot just check this just now, but I am sure it is fine. Go ahead and make these kind of changes with no worries. If there are any issues I will let you know.

I suppose to do this right, I should have both Linux and Windows builds set up and test in both... eventually... :>

Next up: replace _finddata_t in the Linux build with a Linux equivalent...

profile.cpp:6:16: io.h: No such file or directory
profile.cpp: In member function `void
   TeProfileMgr::Load(std::basic_string<char, std::char_traits<char>,
   std::allocator<char> >)':
profile.cpp:449: error: `_finddata_t' undeclared (first use this function)

I found some suggestions:

Try looking at the following functions
opendir
readdir, readdir_r
fnmatch[/color]
scandir, where available
take a look at glob(3c) and ftw/nftw

I have two options:

  1. Make my own reusable functions for file operations using M$ calls or Unix calls depending on the build target
  2. Use the filesystem library in boost

The first is better if the job is small, but little guys can't afford to reinvent the wheel for anything substantial. I already use boost in HTDJ for serialization. It's definitely got a ramp up time, but it's not too heavy once you're up to speed. I will explore the boost filesystem library docs next...

That io.h include is coming from the MinGW lib, which is base set of C/C++ headers that allows you to compile windows apps with GCC. Look at www.mingw.org. There should be a mingw or a mingw32 package to install under Linux. I run mepis, which uses Synaptic, and there is a mingw32 package.

I used mingw and gcc specificall so for easo-breezo cross platform. Not so easy I guess.

Try changing the "io.h" to <io.h> or <io> and see if that works? Then maybe install that mingw32 package and try <io.h>? I thought this stuff bought us cross-platform in a big way, so I would like to try and figure it out first before the boost option.

1/2 of the stuff I do at work is on Linux, BTW, so I am coming up to speed rather quick. I use Kdevelop at work, although I try to do as much as I can from the command line so that I can be a Linux nerd too :-) So far, cream is my favorite command line style editing proggie.

I am building up a linux laptop tonight so that I can be more useful on the Linux side. It will take me a while to get it all config'd and updated like my box at work is.