[SOLVED] warning c4251

Problems building or running the engine, queries about how to use features etc.
Post Reply
old_man_auz
Greenskin
Posts: 100
Joined: Tue Jun 15, 2004 5:10 am
Location: Australia

[SOLVED] warning c4251

Post by old_man_auz »

Hey,

I just tried to integrate TrueAxis into a project Im using. It compiled alright before I added in the TA code and then I compiled and I got these warnings (with another couple 100 following thes ):

Code: Select all

c:...\include\OgreAnimation.h(207) : warning C4251: 'Ogre::Animation::mTrackList' : class 'std::map<_Kty,_Ty>' needs to have dll-interface to be used by clients of class 'Ogre::Animation' 

c:...\include\OgreAnimation.h(208) : warning C4251: 'Ogre::Animation::mName' : class 'std::basic_string<_Elem,_Traits,_Ax>' needs to have dll-interface to be used by clients of class 'Ogre::Animation' 

c:...\include\OgreSimpleSpline.h(111) : warning C4251: 'Ogre::SimpleSpline::mPoints' : class 'std::vector<_Ty>' needs to have dll-interface to be used by clients of class 'Ogre::SimpleSpline' 
I know there are other topics on this warning but they had to do with seperate libraries and not when compiling a project with Ogre. Im using the Ogre 1.0.5 SDK.

I tried to remove all the header files and header/linking directories I added into my project settings to get TA working, so my project settings were back the way they were, but I still get all the warnings.

Thanks for any help
Last edited by old_man_auz on Thu Nov 17, 2005 5:13 am, edited 2 times in total.
User avatar
Olex
Hobgoblin
Posts: 593
Joined: Fri Apr 08, 2005 6:08 pm
Location: WA, USA

Post by Olex »

So you want to simply remove those warnings?

And btw maybe VS 2005 will do that already for you? It is supposed to be 95% ANSI C++. :roll:
old_man_auz
Greenskin
Posts: 100
Joined: Tue Jun 15, 2004 5:10 am
Location: Australia

Post by old_man_auz »

Well they do look ugly when you compile a project and you get all those warnings.

The thing is that they have never shown up when Ive compiled my project before or any other ogre project for that matter, and then I start to implement TrueAxis and I get all the warnings, plus some errors in TA so I remove TA and still get all the warnings..

I was kinda puzzled, thought Id stuft something.

Im using Visual C++ Toolkit 2003 if that makes any difference.
User avatar
Olex
Hobgoblin
Posts: 593
Joined: Fri Apr 08, 2005 6:08 pm
Location: WA, USA

Post by Olex »

So have you tried turning those warning off using pragma's ? Is this what you want to do?
old_man_auz
Greenskin
Posts: 100
Joined: Tue Jun 15, 2004 5:10 am
Location: Australia

Post by old_man_auz »

Well all the articles on the Ogre Forums and in the Google results said to pretty much just ignore the warnings..turn them off, which is what you just said. And if thats a valid way to fix the problem then Im happy enough to do that. ..

But I was wondering more, why do I get them all of a sudden when I compile my project. I assume on one else gets these warnings when they compile Ogre projects.
User avatar
Olex
Hobgoblin
Posts: 593
Joined: Fri Apr 08, 2005 6:08 pm
Location: WA, USA

Post by Olex »

old_man_auz wrote:But I was wondering more, why do I get them all of a sudden when I compile my project. I assume on one else gets these warnings when they compile Ogre projects.
What does MSDN say on this warning?
old_man_auz
Greenskin
Posts: 100
Joined: Tue Jun 15, 2004 5:10 am
Location: Australia

Post by old_man_auz »

This is from msdn.
http://msdn.microsoft.com/library/defau ... fivone.asp
A base class or structure must be declared with the __declspec(dllexport) keyword for a function in a derived class to be exported.
I assume that Ogre has this for all its classes in the precompiled SDK.
User avatar
Olex
Hobgoblin
Posts: 593
Joined: Fri Apr 08, 2005 6:08 pm
Location: WA, USA

Post by Olex »

Not an expert here, but looks like TrueAxis and Ogre have different defines for exports, and they somehow collide. You should try to separate them somehow when including their files.

EDIT: maybe undef/def clauses?
old_man_auz
Greenskin
Posts: 100
Joined: Tue Jun 15, 2004 5:10 am
Location: Australia

Post by old_man_auz »

Thanks for you help btw Olex,

When I first got all these warnings, I was curiosu to see weather it was TA so I removed all the headers for the TA stuff and revomed all the directories I added in in the project settings, and I still got all the warnings. Should I still look into what you said ?
User avatar
Olex
Hobgoblin
Posts: 593
Joined: Fri Apr 08, 2005 6:08 pm
Location: WA, USA

Post by Olex »

:D Heh, probably not, in this case, you mostly likely have Ogre inproperly setup.
User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US
x 22

Post by xavier »

No, this is common when returning STL containers or classes from exported DLL functions or class members. They are harmless, and can safely be ignored.

These warnings are already #pragma'ed out of Ogre builds; it is possible that the TrueAxis headers turn them back on.
old_man_auz
Greenskin
Posts: 100
Joined: Tue Jun 15, 2004 5:10 am
Location: Australia

Post by old_man_auz »

ok, thanks Olex and xavier, ill just ignore the errors then.
old_man_auz
Greenskin
Posts: 100
Joined: Tue Jun 15, 2004 5:10 am
Location: Australia

Post by old_man_auz »

Ok I fixed the problem,

I removed the errors by rearranging the order of my header files.

I used to have
- Newton Header Files
- Cegui Header Files
- Ogre Header Files

The problems occured when I removed the newton header files
When I changed the order for this, it removed all the warnings.
- Ogre headers
- CEGUI headers
- TrueAxis headers
Post Reply