2.0.16 compile (Make) error

Questions or HOWTOs about the above? Post 'em here...
Post Reply
User avatar
Grans Remedy
Private First Class
Private First Class
Posts: 91
Joined: Sun Dec 05, 2004 10:47 pm
Location: New Zealand

2.0.16 compile (Make) error

Post by Grans Remedy »

Howdy,
Just downloaded current source from http://sourceforge.net/projects/bzflag/files/

Configures ok, but make stops with this error:

Code: Select all

g++ -DHAVE_CONFIG_H -I. -I../../include  -I../../include  -DINSTALL_LIB_DIR=\"/usr/local/lib/bzflag/\" -DINSTALL_DATA_DIR=\"/usr/local/share/bzflag\"    -fsigned-char -Wno-deprecated -g -O2  -Wall -W -ffast-math -fno-exceptions -c -o AutoPilot.o AutoPilot.cxx
In file included from AutoPilot.cxx:21:0:
Roster.h:41:28: error: ‘MAX_ROBOTS’ was not declared in this scope
make[2]: *** [AutoPilot.o] Error 1
make[2]: Leaving directory `/home/me/bin/bzflag/src/bzflag'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/me/bin/bzflag/src'
make: *** [all-recursive] Error 1
How do I fix this/work around it?
Thanks
Grans
No coffee, no workee
User avatar
blast
General
General
Posts: 4931
Joined: Fri Mar 21, 2003 3:49 pm
Location: playing.cxx
Contact:

Re: 2.0.16 compile (Make) error

Post by blast »

I'd say to try grabbing the v2_0branch SVN code instead. Some additional things have gone in there since the 2.0.16 release.

http://my.bzflag.org/w/SVN
"In addition to knowing the secrets of the Universe, I can assure you that I am also quite potty trained." -Koenma (Yu Yu Hakusho)

Image
User avatar
Grans Remedy
Private First Class
Private First Class
Posts: 91
Joined: Sun Dec 05, 2004 10:47 pm
Location: New Zealand

Re: 2.0.16 compile (Make) error

Post by Grans Remedy »

Hmmm...nope, same error with source from SVN (2.0.17).
Any other ideas?
No coffee, no workee
darkid
Private First Class
Private First Class
Posts: 131
Joined: Wed Aug 12, 2009 5:03 pm

Re: 2.0.16 compile (Make) error

Post by darkid »

Download the pre-compiled package?
Darkid--Not a happy camper.
User avatar
FiringSquad
Sergeant
Sergeant
Posts: 849
Joined: Thu Jan 26, 2006 5:53 pm
Location: Ireland

Re: 2.0.16 compile (Make) error

Post by FiringSquad »

config.h should have the line
#define ROBOT 1

global.h should have the line
#ifdef ROBOT
// robots
#define MAX_ROBOTS 100
#endif


This defines the MAX_ROBOTS value.

Roster.h should have the following line
#include "global.h"

AutoPilot.cxx should have the line
#include "Roster.h"

If all of this is in place then the error should not occur.

With all of the various switches and precompilations, it can get a little messed up.

Try performing a clean build that removes precompiled headers etc.

If you know what you're doing, you can examine the verbose build output to see if the correct files are being loaded and read.

If the project is too complex to get a full overview, you can try inserting uncompilable code before the definitions to see if they are being processed.
e.g.
#ifdef ROBOT
Do not;
blame me;
FiringSquad told me to do it.
#define MAX_ROBOTS 100
#endif
If it doesn't produce an error then the #define has been lost.

There are many reasons why these things can fail. Hopefully this gives you the basic tools you need to figure it out.
Last edited by FiringSquad on Wed Jan 12, 2011 2:08 pm, edited 1 time in total.
User avatar
blast
General
General
Posts: 4931
Joined: Fri Mar 21, 2003 3:49 pm
Location: playing.cxx
Contact:

Re: 2.0.16 compile (Make) error

Post by blast »

Grans, what are you passing to ./configure ?
"In addition to knowing the secrets of the Universe, I can assure you that I am also quite potty trained." -Koenma (Yu Yu Hakusho)

Image
User avatar
FiringSquad
Sergeant
Sergeant
Posts: 849
Joined: Thu Jan 26, 2006 5:53 pm
Location: Ireland

Re: 2.0.16 compile (Make) error

Post by FiringSquad »

hmmm...
Interesting:
common.h wrote:#ifdef _DEVCPP /* the Dev-C++ build is acting very stubborn; this is (hopefully) -temporary- */
# include_next "config.h"
#else
# include "config.h"
#endif
Are you compiling on Windows?
"include_next" will not follow the standard search route, so it might be loading some other "config.h"
try changing it to "#include" instead.
User avatar
blast
General
General
Posts: 4931
Joined: Fri Mar 21, 2003 3:49 pm
Location: playing.cxx
Contact:

Re: 2.0.16 compile (Make) error

Post by blast »

That should only be if he was using DevCpp/DevC++ (whatever the name is), which we no longer support.
"In addition to knowing the secrets of the Universe, I can assure you that I am also quite potty trained." -Koenma (Yu Yu Hakusho)

Image
User avatar
Grans Remedy
Private First Class
Private First Class
Posts: 91
Joined: Sun Dec 05, 2004 10:47 pm
Location: New Zealand

Re: 2.0.16 compile (Make) error

Post by Grans Remedy »

blast wrote:Grans, what are you passing to ./configure ?

Code: Select all

./configure --disable-robots --disable-bzadmin
results in

Code: Select all

BZFlag-2.0.17.20110111 with the following:
     curses: -lncurses
     SDL
     no bzadmin client binary!
     bzflag client
Did a 'make clean' before re-running.
No coffee, no workee
User avatar
Grans Remedy
Private First Class
Private First Class
Posts: 91
Joined: Sun Dec 05, 2004 10:47 pm
Location: New Zealand

Re: 2.0.16 compile (Make) error

Post by Grans Remedy »

FiringSquad wrote:config.h should have the line
#define ROBOT 1

global.h should have the line
#ifdef ROBOT
// robots
#define MAX_ROBOTS 100
#endif
Where is this header file (global.h) supposed to be? I found global.cxx in /src/Common but can't find its header.
FiringSquad wrote: Roster.h should have the following line
#include "global.h"
Yep its there.
FiringSquad wrote: AutoPilot.cxx should have the line
#include "Roster.h"
Yep its there.

Compiling on Suse Linux (_64)

cheers
Grans
No coffee, no workee
User avatar
FiringSquad
Sergeant
Sergeant
Posts: 849
Joined: Thu Jan 26, 2006 5:53 pm
Location: Ireland

Re: 2.0.16 compile (Make) error

Post by FiringSquad »

Grans Remedy wrote:Where is this header file (global.h) supposed to be?
It's supposed to be in the "include" directory.
User avatar
Grans Remedy
Private First Class
Private First Class
Posts: 91
Joined: Sun Dec 05, 2004 10:47 pm
Location: New Zealand

Re: 2.0.16 compile (Make) error

Post by Grans Remedy »

FiringSquad wrote:
Grans Remedy wrote:Where is this header file (global.h) supposed to be?
It's supposed to be in the "include" directory.
Ok thanks, I was only looking inside the /src directory.

global.h is as expected, but config.h is not.

searching inside config.h has this:

Code: Select all

/* Enabling Robots */
/* #undef ROBOT */
and config.h.in has this:

Code: Select all

/* Enabling Robots */
#undef ROBOT
I'm guessing that is because I passed --disable-robots to configure. This is kinda looking like a bug. I'll try it without disabling robots and see what happens.

Cheers
Grans
No coffee, no workee
User avatar
Grans Remedy
Private First Class
Private First Class
Posts: 91
Joined: Sun Dec 05, 2004 10:47 pm
Location: New Zealand

Re: 2.0.16 compile (Make) error

Post by Grans Remedy »

Yup - looks like there's an issue with passing --disable-robots to configure. Compiled fine without it.
Cheers
Grans
No coffee, no workee
User avatar
Bullet Catcher
Captain
Captain
Posts: 564
Joined: Sat Dec 23, 2006 7:56 am
Location: Escondido, California

Re: 2.0.16 compile (Make) error

Post by Bullet Catcher »

Revision 21353 of v2_0branch now fixes the compile errors when --disable-robots is used.
User avatar
FiringSquad
Sergeant
Sergeant
Posts: 849
Joined: Thu Jan 26, 2006 5:53 pm
Location: Ireland

Re: 2.0.16 compile (Make) error

Post by FiringSquad »

Thanks BC :-)

See! Development is still going on. :P
Post Reply