includes question

includes question

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
drwho
Posts: 6
Joined: 31 Oct 2009, 17:12

includes question

Post by drwho »

My apologies in advance, because I know that this is an ultra noob question to ask.

I run into problems sometimes when building Spring where it's a matter of a simple include file or #define that is missing from a source file. I assume that this is my environment since the developer who checked in the given change must have tested to make sure they could build.

For example, I recently pulled from latest via git, and in BaseNetProtocol.cpp, the following had been added as part of a larger change:

Code: Select all

*packet << static_cast<uint16_t>(size) << reason;
This produced the following error:

Code: Select all

error C2061: syntax error : identifier 'uint16_t'	e:\Projects\spring\rts\System\BaseNetProtocol.cpp	41
This made perfect sense since uint16_t was defined in System.h and that was not included, adding this include fixed the issue.

There are other examples of this as well, but, I didn't want to spam the forum with them.

My question is, am I doing something wrong here so that when someone checks in a change, I need to add these extra includes and defines to these various files?

Again, my apologies for the super-noobish question.

Mike
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: includes question

Post by hoijui »

stuff like that may happen when using different build systems or compilers. most developpers use gcc on linux with CMake, though there are others.
i dont exaclty know how it hapens, could also have to do with precompiled headers and whatnot, but it is not cause you do something wrong. maybe system is included by an include in an included file or so, but if somethign from System.h is used in a .cpp file, then System.h should be included there, whether it is already included in an include or not.
so if stuff like this happens, commit it to your github forge of spring (if you do not habe one, make one) and then ask in #sy for a dev to have a look at it/include it into the main repo.
User avatar
drwho
Posts: 6
Joined: 31 Oct 2009, 17:12

Re: includes question

Post by drwho »

Thanks hoijui,

I did get the impression from the forums that many people are building on Linux, which could be part of the issue as I am doing my builds on Windows XP and Windows 7 now.

In a way, it's a good experience. It helps me to figure this stuff out, I just wanted to make sure I wasn't missing some magic there somewhere. :-)
Post Reply

Return to “Engine”