Page 1 of 1

2.0.16 compile (Make) error

Posted: Mon Jan 10, 2011 10:55 pm
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

Re: 2.0.16 compile (Make) error

Posted: Tue Jan 11, 2011 1:49 am
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

Re: 2.0.16 compile (Make) error

Posted: Tue Jan 11, 2011 4:34 am
by Grans Remedy
Hmmm...nope, same error with source from SVN (2.0.17).
Any other ideas?

Re: 2.0.16 compile (Make) error

Posted: Tue Jan 11, 2011 11:57 am
by darkid
Download the pre-compiled package?

Re: 2.0.16 compile (Make) error

Posted: Tue Jan 11, 2011 3:47 pm
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.

Re: 2.0.16 compile (Make) error

Posted: Tue Jan 11, 2011 3:51 pm
by blast
Grans, what are you passing to ./configure ?

Re: 2.0.16 compile (Make) error

Posted: Tue Jan 11, 2011 3:58 pm
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.

Re: 2.0.16 compile (Make) error

Posted: Tue Jan 11, 2011 7:42 pm
by blast
That should only be if he was using DevCpp/DevC++ (whatever the name is), which we no longer support.

Re: 2.0.16 compile (Make) error

Posted: Tue Jan 11, 2011 10:00 pm
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.

Re: 2.0.16 compile (Make) error

Posted: Tue Jan 11, 2011 10:05 pm
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

Re: 2.0.16 compile (Make) error

Posted: Tue Jan 11, 2011 10:13 pm
by FiringSquad
Grans Remedy wrote:Where is this header file (global.h) supposed to be?
It's supposed to be in the "include" directory.

Re: 2.0.16 compile (Make) error

Posted: Tue Jan 11, 2011 10:32 pm
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

Re: 2.0.16 compile (Make) error

Posted: Tue Jan 11, 2011 10:53 pm
by Grans Remedy
Yup - looks like there's an issue with passing --disable-robots to configure. Compiled fine without it.
Cheers
Grans

Re: 2.0.16 compile (Make) error

Posted: Sun Jan 16, 2011 9:28 pm
by Bullet Catcher
Revision 21353 of v2_0branch now fixes the compile errors when --disable-robots is used.

Re: 2.0.16 compile (Make) error

Posted: Thu Jan 20, 2011 2:19 pm
by FiringSquad
Thanks BC :-)

See! Development is still going on. :P