[2.2] VS2019 error C2039 in OgreFastArray.h
Posted: Sat Jul 11, 2020 12:20 am
Hello,
I just started a new empty visual studio project with minimal code and only ogre for easier debugging and I`m getting the following error:
This is with the pre-build sdk, but I got the same error with ogre that I built from source recently. I thought it was a conflict with another library I´m using and quickly fixed it by adding: #include <algorithm> to OgreFastArray.h.
But now I looked at it by right clicking on "max" then "go to definition" and it leads to OgreCommon.h, which has functions called "max".
So basically VS2019 on Windows 10 gets confused and ignores the std:: .
Funnily this doesn`t happen when building ogre. It builds and installs completely fine.
I think it may have to do with the order in which headers are included by the user.
To reproduce just add the following headers to a source file in an empty project and tell VS2019 where the headers and libs are located.
No other code needed. It doesn`t build further than that.
I just started a new empty visual studio project with minimal code and only ogre for easier debugging and I`m getting the following error:
Code: Select all
1>------ Build started: Project: OgreMinimumSample, Configuration: Debug x64 ------
1>Source.cpp
1>D:\ogre-sdk-v2.2.3-vc19-x64\include\OGRE\OgreFastArray.h(83,34): error C2039: 'max': is not a member of 'std'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include\vector(24): message : see declaration of 'std'
1>D:\ogre-sdk-v2.2.3-vc19-x64\include\OGRE\OgreFastArray.h(370): message : see reference to class template instantiation 'Ogre::FastArray<T>' being compiled
1>Done building project "OgreMinimumSample.vcxproj" -- FAILED.But now I looked at it by right clicking on "max" then "go to definition" and it leads to OgreCommon.h, which has functions called "max".
So basically VS2019 on Windows 10 gets confused and ignores the std:: .
Funnily this doesn`t happen when building ogre. It builds and installs completely fine.
I think it may have to do with the order in which headers are included by the user.
To reproduce just add the following headers to a source file in an empty project and tell VS2019 where the headers and libs are located.
Code: Select all
#include "OgreWindowEventUtilities.h"
#include "Vao/OgreVaoManager.h"
#include "OgreRoot.h"
#include "OgreRenderSystem.h"
#include "OgreWindow.h"
#include "OgreCamera.h"
#include "Compositor/OgreCompositorManager2.h"