Compiling map.cpp forces a complete rebuild

For those having trouble installing/running the game or to report a bug

Moderator: Staff

nemesis
Senior Member
Posts: 157
Joined: Fri Apr 29, 2011 7:53 am
Location: Sachsen/Germany

Compiling map.cpp forces a complete rebuild

Postby nemesis » Thu Jun 30, 2011 7:48 am

Right now I don't know anything about the build system of Code::Blocks, but at least for me it happens that the complete project is rebuilt (except for common.cpp as I could see so far) when I change something in the map.cpp file. Basically this should not be intended, i.e. only this source file should be compiled, since it is no header and therefore not linked to any other source file. For me, right now this happens only for map.cpp, i.e. the behavior of the build-system is correct for any other source file that I've tested.

Does this happen for anybody else? If yes, can somebody who knows more about Code::Blocks have a look, what's going on. I spent some time but didn't find anything.

Using:
Windows 7 / XP (happens for both)
Code::Block 10.05

Thanks in advance. :)
nemesis
Senior Member
Posts: 157
Joined: Fri Apr 29, 2011 7:53 am
Location: Sachsen/Germany

Re: Compiling map.cpp forces a complete rebuild

Postby nemesis » Wed Jul 06, 2011 12:24 pm

It took the full lunch break ...

The reason for this is the line

Code: Select all

#include <map>

in utils.h. The bad point here is that we also have a folder map, and since all source directories are passed as search directories, there is some confusion for the build system.

Some file in map was changed -> something was changed for the includes of utils.h -> almost all files are affected

To avoid this I would propose renaming the directory map to lets say map_mode. This works for me but I don't want to commit a rename for a directory without telling before.

However, the reason for me is simply that I takes a significant amount of time having almost all files compiled when making a small change in one of the map-files.

Does everybody agree?
User avatar
gorzuate
Developer
Posts: 2575
Joined: Thu Jun 17, 2004 3:03 am
Location: Hermosa Beach, CA
Contact:

Re: Compiling map.cpp forces a complete rebuild

Postby gorzuate » Wed Jul 06, 2011 6:15 pm

Change the code to this instead:

Code: Select all

#include <map.h>
or rather

Code: Select all

#include "map.h"
nemesis
Senior Member
Posts: 157
Joined: Fri Apr 29, 2011 7:53 am
Location: Sachsen/Germany

Re: Compiling map.cpp forces a complete rebuild

Postby nemesis » Wed Jul 06, 2011 7:53 pm

The problem is <map> from the C++ STL and not our map.h.
User avatar
Roots
Dictator
Posts: 8666
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: Compiling map.cpp forces a complete rebuild

Postby Roots » Wed Jul 06, 2011 8:37 pm

Wait, I'm confused. What system is this that you're having trouble on? I don't believe I've had any trouble with re-compiling map mode on my Linux systems using the official config/make.

And by the way, #include <map> is included in utils.h, as are all the other standard STL containers. You should never need to #include <map>, because pretty much all code needs to have "utils.h" included.
Image
nemesis
Senior Member
Posts: 157
Joined: Fri Apr 29, 2011 7:53 am
Location: Sachsen/Germany

Re: Compiling map.cpp forces a complete rebuild

Postby nemesis » Wed Jul 06, 2011 8:49 pm

I'm using Windows with Code::Blocks.

That is where I have trouble. Almost all files include utils.h and have therefore this inclusion. However, I can only tell how it is for me.

When changing any file in the map folder all files including utils.h are compiled. If I change the map folder to a different name this doesn't happen anymore.

But if there is noone else having this problem I will only change this on my working copy.
User avatar
Roots
Dictator
Posts: 8666
Joined: Wed Jun 16, 2004 6:07 pm
Location: Austin TX
Contact:

Re: Compiling map.cpp forces a complete rebuild

Postby Roots » Wed Jul 06, 2011 9:02 pm

So you can change other code that also includes utils.h, like the battle code for instance, and when you re-compile that it does not recompile everything as it does for changing the map code?

If you make any changes to utils.h (which is rare) then I would expect the compiler to have to re-compile a lot of files since so many things include utils.h. However if you're just modifying a file that includes utils.h and the compiler is recompiling everything, then I'd say that either 1) there's something wrong/inefficient with your build setup, or 2) your compiler is not very smart.

I'm against changing map to map_mode in the SVN repository so if you can change it on your local copy only then that would be preferred.
Image
nemesis
Senior Member
Posts: 157
Joined: Fri Apr 29, 2011 7:53 am
Location: Sachsen/Germany

Re: Compiling map.cpp forces a complete rebuild

Postby nemesis » Wed Jul 06, 2011 9:30 pm

Roots wrote:So you can change other code that also includes utils.h, like the battle code for instance, and when you re-compile that it does not recompile everything as it does for changing the map code?

Yepp, changing files like battle.cpp or main.cpp only cause a compilation of this specific file. But when I change any file the map-directory (e.g. map.cpp, map_objects.cpp) all files including utils.h are compiled, i.e. it "feels" like having changed utils.h although it was not touched.
Roots wrote:1) there's something wrong/inefficient with your build setup, or 2) your compiler is not very smart.

Seems so. I guess it is the builder system of Code::Blocks since it tells the compiler what to do.
Roots wrote:I'm against changing map to map_mode in the SVN repository so if you can change it on your local copy only then that would be preferred.

Agreed. But it would still be interesting for me if this happens for other Windows/Code::Blocks/MinGW-GCC-4.4 users as well.

... discussion closed so far. ;)

Return to “Technical Issues”

Who is online

Users browsing this forum: No registered users and 1 guest