basename() missing when compiling in Windows

What do you want to see in Armagetron soon? Any new feature ideas? Let's ponder these ground breaking ideas...
Post Reply
k
Random Identifier & Project Developer
Posts: 345
Joined: Wed Feb 25, 2004 12:54 am
Location: Northern California, USA

basename() missing when compiling in Windows

Post by k »

I've been working on switching over to MINGW and CodeBlocks for Windows development. I'll be adding a step-by-step tutorial to the wiki in the next week or so and hopefully get my automated Windows builds working again.

I checked out the latest trunk yesterday and it doesn't compile anymore as the basename() function doesn't exist. It is not a function provided by Microsoft and doesn't appear to be available in MINGW yet.

Code: Select all

..\armagetronad\src\engine\eSoundMixer.cpp: In member function `tString eSoundMixer::GetCurrentSong()':
..\armagetronad\src\engine\eSoundMixer.cpp:525: error: `basename' was not declared in this scope
I checked the MINGW project and there is a lot of debate on adding it to MINGW (search for libgen.h in the mail archives) but I haven't found out yet if it will be included or not. If we need to add our own function for Windows we can get a copy of it here:
http://sourceforge.net/mailarchive/mess ... d=11968414. I'll leave it for someone else to add if needed as I am still getting things set up and haven't looked into using svn to do more than check out files anonymously.

User avatar
wrtlprnft
Reverse Outside Corner Grinder
Posts: 1679
Joined: Wed Jan 04, 2006 4:42 am
Location: 0x08048000
Contact:

Post by wrtlprnft »

Any reason we need that function? We can just do somestring.SubStr(somestring.find_last_of('/')) (replace the / by \\ under windows). That should be way easier :)
There's no place like ::1

User avatar
Lucifer
Project Developer & Local Moonshiner
Posts: 8610
Joined: Sun Aug 15, 2004 3:32 pm
Location: Republic of Texas
Contact:

Post by Lucifer »

It's supposed to be platform independence. :) Use a function that you expect to find on the target platform so you don't have to deal with things like path separators and the like.
Image

Be the devil's own, Lucifer's my name.
- Iron Maiden

User avatar
Z-Man
God & Project Admin
Posts: 11253
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne, Jabber: [email protected]
Contact:

Post by Z-Man »

I think it would be better to follow the path K hinted at: take the linked implementation, put it into some file that is only compiled on Windows and put the prototype in config.h in Windows or a new header. This isn't the first function where this happens (see mkdir) and it won't be the last.

Luke-Jr
Dr Z Level
Posts: 2246
Joined: Sun Mar 20, 2005 4:03 pm
Location: IM: [email protected]

Re: basename() missing when compiling in Windows

Post by Luke-Jr »

k wrote:I've been working on switching over to MINGW and CodeBlocks for Windows development. I'll be adding a step-by-step tutorial to the wiki in the next week or so and hopefully get my automated Windows builds working again.
Shouldn't it go into README-Subversion?

User avatar
Z-Man
God & Project Admin
Posts: 11253
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne, Jabber: [email protected]
Contact:

Post by Z-Man »

You only get that file if you already know how to check out a subversion repository and which one to get :) I think all the READMEs should be moved to the WIKI, except the main README stating the where the others went and of course README-SDL.

K: there already is a page describing the installation (albeit not geared for the current Trunk and SVN yet, joda hadn't done his conversion to experimental Code::Blocks project files when I wrote it):
http://wiki.armagetronad.net/index.php/ ... ent_System

Luke-Jr
Dr Z Level
Posts: 2246
Joined: Sun Mar 20, 2005 4:03 pm
Location: IM: [email protected]

Post by Luke-Jr »

z-man wrote:You only get that file if you already know how to check out a subversion repository and which one to get :)
Hey, I didn't decide to put the compile instructions there! =p
z-man wrote:I think all the READMEs should be moved to the WIKI, except the main README stating the where the others went and of course README-SDL.
Build instructions are versioned with the game itself, so it needs to stay in Svn until the wiki allows branching/tagging and such...
I've always wondered: why is README-SDL there anyway? If anywhere, it should be only in winlibs (since it has the SDL runtime environment)-- and even then, short-term since we can hopefully just use a svn external to link to SDL's Svn repo...

User avatar
Z-Man
God & Project Admin
Posts: 11253
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne, Jabber: [email protected]
Contact:

Post by Z-Man »

We didn't have the wiki back when the files were created, remember it or not :)

Anyway, the compilation instructions can stay in SVN, of course. But most of the file is "what else you need to check out to get it running", which is clearly wiki material for the "What you need to check out to get it running" page, especially since now, the best way is to just check out armagetronad/trunk as a whole (or one of the workspaces) and everything will be in place.

k
Random Identifier & Project Developer
Posts: 345
Joined: Wed Feb 25, 2004 12:54 am
Location: Northern California, USA

Post by k »

z-man wrote:K: there already is a page describing the installation (albeit not geared for the current Trunk and SVN yet, joda hadn't done his conversion to experimental Code::Blocks project files when I wrote it):
http://wiki.armagetronad.net/index.php/ ... ent_System
I know, but since I started everything over from scratch in a virtual machine I figured I would document everything needed step by step to get a working Windows build environment. I've also written a batch file that I will include to check out all the files needed for the trunk, a branch, or a tag. I figure the easier it is to get people set up to develop the more help we might get.

On a side note, I noticed while trying to make a build that some of the build files are still in the VisualC directory (banner.*, the url file, nsis files, and maybe a few others). Will they be moved to the CodeBlocks directory since it is now going to be the supported ide (or maybe move all the non compiler specific windows build files to a build_windows directory)?

Luke-Jr
Dr Z Level
Posts: 2246
Joined: Sun Mar 20, 2005 4:03 pm
Location: IM: [email protected]

Post by Luke-Jr »

k wrote:On a side note, I noticed while trying to make a build that some of the build files are still in the VisualC directory (banner.*, the url file, nsis files, and maybe a few others). Will they be moved to the CodeBlocks directory since it is now going to be the supported ide (or maybe move all the non compiler specific windows build files to a build_windows directory)?
A reminder that we are moving to a build/visualc structure anyhow.
Shouldn't be much larger a step to make it build/windows/visualc and build/windows/common

User avatar
Z-Man
God & Project Admin
Posts: 11253
Joined: Sun Jan 23, 2005 6:01 pm
Location: Cologne, Jabber: [email protected]
Contact:

Post by Z-Man »

Luke-Jr wrote:A reminder that we are moving to a build/visualc structure anyhow.
A reminder that this decision is pending and will be made when 0.2.8 is dead.

Post Reply