About Store Forum Documentation Contact



Post Reply 
Variable declaration mistaken for function in ES
Author Message
Pixel Perfect Offline
Member

Post: #1
Variable declaration mistaken for function in ES
I have another compilation issue where a variable definition is being mistaken for a function and added to the function definitions in the header file.

Note: I intend changing the STL containers for the Esenthel equivalents but only once I have my existing code fully working.

main.cpp

Code:
std::map<std::string, npc*>   m_mapNPCList;
std::map<std::string, npc*>::iterator   m_mapNPCListIter;


This gets generated in main.h
Code:
/******************************************************************************/
// FUNCTIONS
/******************************************************************************/
std::map<std::string, npc*>::iterator   m_mapNPCListIter;
void updateStepGameLogic(void);
void initializeEKIOne(void);
void updateEKIOne(void);
void handleEKIMessages(void);
void shutdownEKIOne(void);
void createEntityFromEKIMessage(const EKI_One::SystemMessage&, bool createAsAgent);
void setCurrentAnimation(const EKI_One::SystemMessage&);
SkyColor Lerp(C SkyColor &a, C SkyColor &b, flt frac);
...


which causes the following error:
Quote:1>main.cpp
1>c:\users\ian\documents\esenthel 2.0\projects\_build_\kingdom of soul\source\main.cpp(31) : error C2086: 'std::_Tree<_Traits>::iterator m_mapNPCListIter' : redefinition
08-19-2013 07:49 PM
Find all posts by this user Quote this message in a reply
kasinova Offline
Member

Post: #2
RE: Variable declaration mistaken for function in ES
it does look like you are defining npc list twice.
use an extern in your header file and do the declaring in the source :]
08-19-2013 08:14 PM
Find all posts by this user Quote this message in a reply
Pixel Perfect Offline
Member

Post: #3
RE: Variable declaration mistaken for function in ES
Thanks for the comments kasinova, but I don't have a header file. This header is being entirely generated by Esenthel and the issue appears to be that it thinks the iterator definition is a function and as such is adding a function prototype to the header.

I thought there was no need for headers when using ES as it generates the headers automatically, at least that had been my understanding so far.
08-19-2013 08:42 PM
Find all posts by this user Quote this message in a reply
kasinova Offline
Member

Post: #4
RE: Variable declaration mistaken for function in ES
Oh as far as ES I wouldn't know lol :[ I use VS 2012 and so I write out all of my headers.
I'm AFK right now but couldn't you define your iterator from m_mapNPClist?
08-20-2013 01:28 AM
Find all posts by this user Quote this message in a reply
Pixel Perfect Offline
Member

Post: #5
RE: Variable declaration mistaken for function in ES
Thanks again for your input but as far as I know this is the standard syntax for STL container and iterator declarations:

Code:
std::vector<int> myIntVector;
std::vector<int>::iterator myIntVectorIterator;

which is what I'm using.
08-20-2013 08:27 AM
Find all posts by this user Quote this message in a reply
Pixel Perfect Offline
Member

Post: #6
RE: Variable declaration mistaken for function in ES
Sorry to have to bump this but I've not found another way of declaring these that avoids the problem.

Currently I'm having to comment out the declaration in the header file in Visual Studio each time I want to run my code which is not much fun.
08-21-2013 10:03 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #7
RE: Variable declaration mistaken for function in ES
Hi, sorry for the issue, at the moment I can only tell that it will definitely work if you will use EE containers (Memc<int>)
I'll try to make it work in the nearest future.
08-21-2013 11:13 PM
Find all posts by this user Quote this message in a reply
Pixel Perfect Offline
Member

Post: #8
RE: Variable declaration mistaken for function in ES
Thanks for the feedback. Maybe I'll 'bite the bullet' at this point and just get the containers changed over to the Esenthel types. I was hoping to get all the code working first before doing that but there seems little point in putting that off till later now. I would have been doing this at some point anyway so no worries, it's a minor thing really smile
08-21-2013 11:29 PM
Find all posts by this user Quote this message in a reply
Post Reply