Terminus Making the code portable to linux
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:
- Make my own reusable functions for file operations using M$ calls or Unix calls depending on the build target
- 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.
Doh, I hadn't thought of that, I will go check out www.mingw.org now. If you get work time on Linux you are probably past me by now. :> Hey, regarding the autotools setup I've put together, I believe autotools and Kdevelop play nicely, but not positive. Feel free to change direction if Kdevelop has a different way of building the project that you would prefer. In the meantime, I'm checking out MinGW...
Hrmm, at first glance it looks like MinGW is specifically for a Windows development environment. IE, it allows you to use gcc on Windows with Windows-specific API's and functions (like _finddata_t). But you mention that Synaptic serves it up on mepis. I'm digging to see if a Fedora package exists...
The autotools stuff is cool - let's keep it - viss our command line ve shall take over za vurld! :) My linux box is built, but I haven't done anything with it yet - I am working on the Windows side tonight.
Oh, btw, the code changes you checked in work fine. I haven't received emails from the last couple of wiki changes you entered, so I was not aware of the code changes until you sent that email. Is your SMTP the wiki points to working?
I think the wiki's working, I'm getting emails. You might need to fix your watch settings, as I moved the pages around a little bit - try clicking on that "watch" tab above...
Yeah, I was no longer set up to watch this page. Testing, 1.. 2.. 3..
How about if *I* change it? That should send you an email...
Back to Linux...
I built up a Fedora box and could not get the autotools working (see the autotools page). So I installed Anjuta and tried to get it working under an IDE and ran into the same compile problem that you had.
I modified profile.cpp slightly so that the file compiles. I will get back to converting the profile search to boost (or whatever) later. The modified code will just cause the game to run with the default profile, which is perfectly fine for playing the game in development.
After that, I was able to compile!!! But not to link, heh, and I gave up at that point because I had solved the important issue. So, get an update of profile.cpp and let me know if the game runs :-)
Hey Johnny! I just svn'ed version 31. I got past profile! And other modules. Final compile results:
system.cpp:67: error: type specifier omitted for parameter `szScreen' system.cpp:67: error: `TeRect rclScreen(TePoint (*)())' redeclared as different kind of symbol system.hpp:35: error: previous declaration of `TeRect rclScreen' system.hpp:35: error: previous non-function declaration `TeRect rclScreen' system.cpp:67: error: conflicts with function declaration `TeRect rclScreen(TePoint (*)())'
Will dig deeper now... It's the same gcc issue I mentioned before, fixed by changing from constructor to assignment (like this):
TeSize szScreen( nScreenW, nScreenH );
...becomes...
TeSize szScreen = TeSize( nScreenW, nScreenH );
Now I'm getting "No rule to make anim.cpp", I assume that file is new? Redoing autotools...
Cool! anim.cpp has been around for some time, though.
Yeah, it's the first file I've gotten to in a subdirectory... looks like I need to tweak my autotools setup... I will check in that one little change I made first.
Curses! Backslashes be damned! :P Moving forward again, after updating terminus/Makefile.am to use FORWARD slashes doh...
util/graph.cpp: In member function `void TeRect::ThickRect(int, unsigned int) const': util/graph.cpp:196: error: syntax error before `,' token
Huh. Just taking a gander at the code, I don't see what the issue is there. They really don't like the way I use constructors, do they?
When I compiled under Linux, I saw all kinds of warnings that I don't get under Windows. To compensate, I cranked up the warning level under my Windows IDE to do some compliance clean-up. But THEN the FMOD header wouldn't compile in, and ther e is nothing I can do about the FMOD libs.
Perhaps a PCLint scan could be tuned to pick up minor compliance problems but not the major ones from FMOD?
I don't get why g++ is complaining, other than it can't seem to distinguish the static constructor from a function declaration for some reason. That's the only real issue I've had, not a big one for sure. Now digging back in to the latest error...
OK, changed this:
TeRect( r(), y - nPad, nPad, h + ( nPad << 1 ) ).FillRect( uiColor );
...to this (again, not sure why, just going with what works, and isn't TOO messy)...
TeRect( this->r(), y - nPad, nPad, h + ( nPad << 1 ) ).FillRect( uiColor );
Now I'm up to the linking errors too!! Whoo! getting closer...
Excellent! I am "working" tonight too :-) I will turn AIM on.
First link error:
game.o(.text+0x150): In function `TeGame::TeGame[not-in-charge]()': /home/m/development/terminus/terminus/game.cpp:42: undefined reference to `TeResultsGui::TeResultsGui[in-charge](TeGame*)'
OK got through them by adding SDL libs to Makefile.am!
terminus_LDADD = ../fmod/api/lib/libfmodex.so /usr/lib/libSDL.so /usr/lib/libSDL_gfx.so /usr/lib/libSDL_image.so
It linked! Now getting a segfault... time for gdb...
This is a total side rail:
http://linux.slashdot.org/article.pl?sid=06/07/31/2227205&threshold=2
Some interesting points to note:
1. Still not that many games for Linux? Good for us!
2. We make our own live CD that runs the game on ANY machine! Brilliant idea!
3. "Ever heard of the Linux Standards Base? If they develop for LSB, it will run on any Linux distro that supports LSB (namely, almost any of the big ones as of now)." I've never even heard of this, myself.
Reading this article made the Linux port of Terminus Est all the more sexy, IMO :-)
Sweet! I really like the live CD idea. I think there is a live Ubuntu educational distro with lots of goodies, we could take that and add to it.
Wish I had more time for all of this, sorry I don't make more progress, it's tough for me to find time for it, at the same time, it's really exciting. Started playing the stock market again a little, with silly dreams of getting somewhere with that. :> Can you imagine if we had all our time to ourselves? In the meantime, it's only 12am, pass the caffeine, I'm just getting started... :P
Hey Johnny long time no compile, but today I grabbed the latest from subversion and it is still all compiling under linux. Hoping to find some debugging time soon. As of now, I'm getting this:
[m@thedigitalmachine terminus]$ ./terminus Fatal signal: Segmentation Fault (SDL Parachute Deployed)
But before that, I get an X window with a nice icon and it's definitely doing something before the segfault...
It has to do with using the default profile - specifically, calling m_oProfiles.Selected(). Johnny do you have any insights? I thought I remember you saying something about removing profiles for now? Digging further..
GOT IT! WE HAVE LINUX TERMINUS! :> The non-default profile code was bracketed with #ifdef WIN32. I just had to move the m_nSelected outside the bracket, so under linux it would use the default that you had provided, John. I have menu! Now I'm going back to try the game... btw, I'm doing this all remotely and so far, terminus has had no problem running on a remote X server. Fun fun!
---
Dude, it totally works, top to bottom. Menus, briefings, and the game itself. Solid! I wouldn't recommend running remotely, unless you like slideshows. I need to get out of bed and go try it on the box directly, to test sound and the performance. But man, nice work, definitely one of the best linux games I've seen!
I'll check in that one line of code. Thanks for letting me debug it under linux! It's been fun!
---
Performance is stellar, and what a difference the sound makes! Great stuff. I'm running on my box that is my router/webserver/mailserver/sqlserver/proxy/kitchensink and there is an occasional hiccup, related to it doing some background task, I am sure, but 98% of the time it is smooth as silk. What a great platform for an epic story, you've got all the pieces. This is really fun John. Well done.
---
Just played through all the missions with ZERO problems! What a sweet game. Seriously. I noticed when I exited that the CPU had been at 100%, but that's fine, it kept the game silky smooth. And other stuff still "happened" on my busy server - there was some network activity, etc. Seriously, the play was identical to the Windows play. SDL and fmod are da bomb.