[SOLVED] warning c4251

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

[SOLVED] warning c4251

Post by old_man_auz » Wed Nov 16, 2005 5:37 am

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.
0 x

User avatar
Olex
Hobgoblin
Posts: 593
Joined: Fri Apr 08, 2005 6:08 pm
Location: WA, USA

Post by Olex » Wed Nov 16, 2005 5:41 am

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:
0 x

old_man_auz
Halfling
Posts: 87
Joined: Tue Jun 15, 2004 5:10 am
Location: Australia

Post by old_man_auz » Wed Nov 16, 2005 6:08 am

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.
0 x

User avatar
Olex
Hobgoblin
Posts: 593
Joined: Fri Apr 08, 2005 6:08 pm
Location: WA, USA

Post by Olex » Wed Nov 16, 2005 6:10 am

So have you tried turning those warning off using pragma's ? Is this what you want to do?
0 x

old_man_auz
Halfling
Posts: 87
Joined: Tue Jun 15, 2004 5:10 am
Location: Australia

Post by old_man_auz » Wed Nov 16, 2005 6:14 am

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.
0 x

User avatar
Olex
Hobgoblin
Posts: 593
Joined: Fri Apr 08, 2005 6:08 pm
Location: WA, USA

Post by Olex » Wed Nov 16, 2005 6:18 am

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?
0 x

old_man_auz
Halfling
Posts: 87
Joined: Tue Jun 15, 2004 5:10 am
Location: Australia

Post by old_man_auz » Wed Nov 16, 2005 6:24 am

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.
0 x

User avatar
Olex
Hobgoblin
Posts: 593
Joined: Fri Apr 08, 2005 6:08 pm
Location: WA, USA

Post by Olex » Wed Nov 16, 2005 6:26 am

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?
0 x

old_man_auz
Halfling
Posts: 87
Joined: Tue Jun 15, 2004 5:10 am
Location: Australia

Post by old_man_auz » Wed Nov 16, 2005 6:31 am

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 ?
0 x

User avatar
Olex
Hobgoblin
Posts: 593
Joined: Fri Apr 08, 2005 6:08 pm
Location: WA, USA

Post by Olex » Wed Nov 16, 2005 6:33 am

:D Heh, probably not, in this case, you mostly likely have Ogre inproperly setup.
0 x

User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US

Post by xavier » Wed Nov 16, 2005 7:04 am

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.
0 x

old_man_auz
Halfling
Posts: 87
Joined: Tue Jun 15, 2004 5:10 am
Location: Australia

Post by old_man_auz » Wed Nov 16, 2005 8:13 am

ok, thanks Olex and xavier, ill just ignore the errors then.
0 x

old_man_auz
Halfling
Posts: 87
Joined: Tue Jun 15, 2004 5:10 am
Location: Australia

Post by old_man_auz » Thu Nov 17, 2005 5:12 am

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
0 x

Post Reply