[Solved] Ogre 2.3 branch - Ogredeps - freeimage issue - windows

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


hedphelym
Gremlin
Posts: 188
Joined: Tue Nov 25, 2008 10:58 am
Location: Kristiansand, Norway
x 23

[Solved] Ogre 2.3 branch - Ogredeps - freeimage issue - windows

Post by hedphelym »

Hi,
I've been trying to compile ogredeps on windows, so that I can compile ogre v2-3 branch, I use vs 2022 (tried combined with 2017 compiler as well), but I end up with this error:

Code: Select all

FreeImage.vcxproj -> E:\temp\Ogre\solution\Dependencies\src\FreeImage\Release\FreeImage.lib
  OgrePrecompiledHeaders.cpp
E:\temp\Ogre\source\ogre\OgreMain\include\OgreString.h(226,21): error C2039: 'hash_compare': is not a member of 'stdext' [E:\temp\Ogre\solution\OgreMain\OgreMain.vcxproj]
  (compiling source file '../../source/ogre/OgreMain/src/OgrePrecompiledHeaders.cpp')
      C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.44.35207\include\iterator(1481,1):
      see declaration of 'stdext'
 
E:\temp\Ogre\source\ogre\OgreMain\include\OgreString.h(226,33): error C2143: syntax error: missing ';' before '<' [E:\temp\Ogre\solution\OgreMain\OgreMain.vcxproj]
  (compiling source file '../../source/ogre/OgreMain/src/OgrePrecompiledHeaders.cpp')
 
E:\temp\Ogre\source\ogre\OgreMain\include\OgreString.h(226,21): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [E:\temp\Ogre\solution\OgreMain
\OgreMain.vcxproj]
  (compiling source file '../../source/ogre/OgreMain/src/OgrePrecompiledHeaders.cpp')

Has anyone of you compiled ogredeps recently on windows?

Last edited by hedphelym on Sun Oct 26, 2025 9:22 am, edited 2 times in total.
przemir
Halfling
Posts: 74
Joined: Sun May 11, 2014 7:55 pm
Location: Poland
x 24

Re: Ogredeps - freeimage issue - windows

Post by przemir »

I built ogre from master branch (4.0) few weeks ago with msvc2022 x64 using modified scripts from https://www.ogre3d.org/download/sdk/sdk-ogre-next (there is no msvc2022 script so best starting point is to change generator in build_ogre_Visual_Studio_16_2019_x64.bat to "Visual Studio 17 2022").

I had problems with SDL2

Code: Select all

  CMake Error at CMakeLists.txt:5 (cmake_minimum_required):
    Compatibility with CMake < 3.5 has been removed from CMake.

Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
to tell CMake that the project requires at least <min> but has been updated
to work with policies introduced by <max> or earlier.

Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway.

  -- Configuring incomplete, errors occurred!

which required changing in ogre-next-deps\src\SDL2\CMakeLists.txt

Code: Select all

cmake_minimum_required(VERSION 3.0.0...3.5.0)

After that Ogre 4.0 builds without problems. Don't know about Ogre 2.3, but ogre dependencies are the same for both versions.

jwwalker
Goblin
Posts: 297
Joined: Thu Aug 12, 2021 10:06 pm
Location: San Diego, CA, USA
x 21

Re: Ogredeps - freeimage issue - windows

Post by jwwalker »

Yes, I compiled Ogredeps on Windows with VS 2022 just a few minutes ago. I got errors on shaderc and SDL2, but FreeImage was OK.

Were those error messages from building FreeImage or OgreNextMain?

hedphelym
Gremlin
Posts: 188
Joined: Tue Nov 25, 2008 10:58 am
Location: Kristiansand, Norway
x 23

Re: Ogredeps - freeimage issue - windows

Post by hedphelym »

Okay, thanks again for the feedback, I have my own build script, that pulls the sources and triggers cmake and all that.
I set it to use VS 2022 - with 2017 compiler.
Good to know that you get it to compile.

The error i get is when compiling the deps:

Code: Select all

Dependencies\src\FreeImage\Source\FreeImage\ToneMapping.cpp(83): error C2440: 'static_cast': c
annot convert from 'double' to 'FREE_IMAGE_CVT_COLOR_PARAM' [E:\temp\Ogre\source\ogre\Dependencies\build\src\FreeImage\
FreeImage.vcxproj]

basically what I do is clone the dependencies, make a build folder, go into that, and call:

Code: Select all

"C:\Program Files\CMake\bin\cmake.exe" -G "Visual Studio 17 2022" -A x64 -T v141 ../
przemir
Halfling
Posts: 74
Joined: Sun May 11, 2014 7:55 pm
Location: Poland
x 24

Re: Ogredeps - freeimage issue - windows

Post by przemir »

hedphelym wrote: Sat Oct 25, 2025 9:33 am

Code: Select all

"C:\Program Files\CMake\bin\cmake.exe" -G "Visual Studio 17 2022" -A x64 -T v141 ../

Do you need this parameter

Code: Select all

-T v141

?
It specify (according to quick search with man cmake and what v141 means) compatibility with Visual Studio 2017.
Try to build it without this parameter.

hedphelym
Gremlin
Posts: 188
Joined: Tue Nov 25, 2008 10:58 am
Location: Kristiansand, Norway
x 23

Re: Ogredeps - freeimage issue - windows

Post by hedphelym »

I have tried without that parameter as well.
The reason why I have it this way is because we use VS2022 editor, but have our codebase set to 2017 compiler.

I now tested without that parameter, just set it to vs2022 and use native compiler.
I still end up with this problem:

Code: Select all

  FreeImage.vcxproj -> E:\temp\Ogre\solution\Dependencies\src\FreeImage\Release\FreeImage.lib
  OgrePrecompiledHeaders.cpp
E:\temp\Ogre\source\ogre\OgreMain\include\OgreString.h(226,21): error C2039: 'hash_compare': is not a member of 'stdext
' [E:\temp\Ogre\solution\OgreMain\OgreMain.vcxproj]
  (compiling source file '../../source/ogre/OgreMain/src/OgrePrecompiledHeaders.cpp')
      C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.44.35207\include\iterator(1481,1):
      see declaration of 'stdext'

E:\temp\Ogre\source\ogre\OgreMain\include\OgreString.h(226,33): error C2143: syntax error: missing ';' before '<' [E:\t
emp\Ogre\solution\OgreMain\OgreMain.vcxproj]
  (compiling source file '../../source/ogre/OgreMain/src/OgrePrecompiledHeaders.cpp')

E:\temp\Ogre\source\ogre\OgreMain\include\OgreString.h(226,21): error C4430: missing type specifier - int assumed. Note
: C++ does not support default-int [E:\temp\Ogre\solution\OgreMain\OgreMain.vcxproj]
  (compiling source file '../../source/ogre/OgreMain/src/OgrePrecompiledHeaders.cpp')

So the problem occurs when compiling the ogrev2-3 branch, not when compiling the dependencies.

przemir
Halfling
Posts: 74
Joined: Sun May 11, 2014 7:55 pm
Location: Poland
x 24

Re: Ogredeps - freeimage issue - windows

Post by przemir »

hedphelym wrote: Sat Oct 25, 2025 9:33 am

Code: Select all

Dependencies\src\FreeImage\Source\FreeImage\ToneMapping.cpp(83): error C2440: 'static_cast': c
annot convert from 'double' to 'FREE_IMAGE_CVT_COLOR_PARAM' [E:\temp\Ogre\source\ogre\Dependencies\build\src\FreeImage\
FreeImage.vcxproj]

I got the same error along with OpenEXR when I tried build dependencies with msvc2015 x86 few weeks ago.

Code: Select all

D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\src\FreeImage\Source\OpenEXR\OpenEXR\ImfPxr24Compressor.cpp(325):
 error C2872: 'half': ambiguous symbol [D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\build\src\FreeImage\FreeI
mage.vcxproj]
  D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\src\FreeImage\Source\OpenEXR\Imath\half.h(902): note: could be
  'Imath_3_1::half half' (compiling source file D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\src\FreeImage\Sou
  rce\OpenEXR\OpenEXR\ImfPxr24Compressor.cpp)
  D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\src\FreeImage\Source\OpenEXR\Imath\half.h(490): note: or
  'Imath_3_1::half' (compiling source file D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\src\FreeImage\Source\O
  penEXR\OpenEXR\ImfPxr24Compressor.cpp)
D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\src\FreeImage\Source\OpenEXR\OpenEXR\ImfPxr24Compressor.cpp(327):
 error C2872: 'half': ambiguous symbol [D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\build\src\FreeImage\FreeI
mage.vcxproj]
  D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\src\FreeImage\Source\OpenEXR\Imath\half.h(902): note: could be
  'Imath_3_1::half half' (compiling source file D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\src\FreeImage\Sou
  rce\OpenEXR\OpenEXR\ImfPxr24Compressor.cpp)
  D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\src\FreeImage\Source\OpenEXR\Imath\half.h(490): note: or
  'Imath_3_1::half' (compiling source file D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\src\FreeImage\Source\O
  penEXR\OpenEXR\ImfPxr24Compressor.cpp)
D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\src\FreeImage\Source\OpenEXR\OpenEXR\ImfPxr24Compressor.cpp(328):
 error C2872: 'half': ambiguous symbol [D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\build\src\FreeImage\FreeI
mage.vcxproj]
  D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\src\FreeImage\Source\OpenEXR\Imath\half.h(902): note: could be
  'Imath_3_1::half half' (compiling source file D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\src\FreeImage\Sou
  rce\OpenEXR\OpenEXR\ImfPxr24Compressor.cpp)
  D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\src\FreeImage\Source\OpenEXR\Imath\half.h(490): note: or
  'Imath_3_1::half' (compiling source file D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\src\FreeImage\Source\O
  penEXR\OpenEXR\ImfPxr24Compressor.cpp)
D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\src\FreeImage\Source\OpenEXR\OpenEXR\ImfPxr24Compressor.cpp(479):
 error C2872: 'half': ambiguous symbol [D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\build\src\FreeImage\FreeI
mage.vcxproj]
  D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\src\FreeImage\Source\OpenEXR\Imath\half.h(902): note: could be
  'Imath_3_1::half half' (compiling source file D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\src\FreeImage\Sou
  rce\OpenEXR\OpenEXR\ImfPxr24Compressor.cpp)
  D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\src\FreeImage\Source\OpenEXR\Imath\half.h(490): note: or
  'Imath_3_1::half' (compiling source file D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\src\FreeImage\Source\O
  penEXR\OpenEXR\ImfPxr24Compressor.cpp)
D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\src\FreeImage\Source\OpenEXR\OpenEXR\ImfPxr24Compressor.cpp(481):
 error C2872: 'half': ambiguous symbol [D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\build\src\FreeImage\FreeI
mage.vcxproj]
  D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\src\FreeImage\Source\OpenEXR\Imath\half.h(902): note: could be
  'Imath_3_1::half half' (compiling source file D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\src\FreeImage\Sou
  rce\OpenEXR\OpenEXR\ImfPxr24Compressor.cpp)
  D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\src\FreeImage\Source\OpenEXR\Imath\half.h(490): note: or
  'Imath_3_1::half' (compiling source file D:\Libraries\Ogre\ogre-next-2025_09_29\ogre-next-deps\src\FreeImage\Source\O
  penEXR\OpenEXR\ImfPxr24Compressor.cpp)

As for Ogre 2.3 I tried to build it (msvc2022 x64) doing similar steps like for Ogre 4.0 and... got the same errors as you:

Code: Select all

  OgrePrecompiledHeaders.cpp
D:\Libraries\Ogre\test\Ogre\ogre-next\OgreMain\include\OgreString.h(226,21): error C2039: 'hash_compare': is not a memb
er of 'stdext' [D:\Libraries\Ogre\test\Ogre\ogre-next\build\OgreMain\OgreMain.vcxproj]
  (compiling source file '../../OgreMain/src/OgrePrecompiledHeaders.cpp')
      C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\include\iterator(1481,1)
  :
      see declaration of 'stdext'

D:\Libraries\Ogre\test\Ogre\ogre-next\OgreMain\include\OgreString.h(226,33): error C2143: syntax error: missing ';' bef
ore '<' [D:\Libraries\Ogre\test\Ogre\ogre-next\build\OgreMain\OgreMain.vcxproj]
  (compiling source file '../../OgreMain/src/OgrePrecompiledHeaders.cpp')

D:\Libraries\Ogre\test\Ogre\ogre-next\OgreMain\include\OgreString.h(226,21): error C4430: missing type specifier - int
assumed. Note: C++ does not support default-int [D:\Libraries\Ogre\test\Ogre\ogre-next\build\OgreMain\OgreMain.vcxproj]
  (compiling source file '../../OgreMain/src/OgrePrecompiledHeaders.cpp')

Wersja programu MSBuild 17.14.23+b0019275e dla .NET Framework

  OgrePrecompiledHeaders.cpp
D:\Libraries\Ogre\test\Ogre\ogre-next\OgreMain\include\OgreString.h(226,21): error C2039: 'hash_compare': is not a memb
er of 'stdext' [D:\Libraries\Ogre\test\Ogre\ogre-next\build\OgreMain\OgreMain.vcxproj]
  (compiling source file '../../OgreMain/src/OgrePrecompiledHeaders.cpp')
      C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.44.35207\include\iterator(1481,1)
  :
      see declaration of 'stdext'

D:\Libraries\Ogre\test\Ogre\ogre-next\OgreMain\include\OgreString.h(226,33): error C2143: syntax error: missing ';' bef
ore '<' [D:\Libraries\Ogre\test\Ogre\ogre-next\build\OgreMain\OgreMain.vcxproj]
  (compiling source file '../../OgreMain/src/OgrePrecompiledHeaders.cpp')

D:\Libraries\Ogre\test\Ogre\ogre-next\OgreMain\include\OgreString.h(226,21): error C4430: missing type specifier - int
assumed. Note: C++ does not support default-int [D:\Libraries\Ogre\test\Ogre\ogre-next\build\OgreMain\OgreMain.vcxproj]
  (compiling source file '../../OgreMain/src/OgrePrecompiledHeaders.cpp')

Done!

I only changed CMake version for SDL change. After that ogre dependencies builds without problems, even FreeImage. It is Ogre 2.3 which does not build.

hedphelym
Gremlin
Posts: 188
Joined: Tue Nov 25, 2008 10:58 am
Location: Kristiansand, Norway
x 23

Re: Ogredeps - freeimage issue - windows

Post by hedphelym »

Yeah, thanks for checking.
I'll dig into it a little bit when I have time and see if I possibly can figure out a way to get around the issue.
At least now I know it's not my setup\system that is the issue.

The reason why I need 2.3 is because we have a massive codebase that uses 2.1, and I've been preparing for a upgrade of ogre in the project.
And I do not want to jump straight to the latest, so I figured 2.3 would be a nice fit (has some of the new features that we want).

hedphelym
Gremlin
Posts: 188
Joined: Tue Nov 25, 2008 10:58 am
Location: Kristiansand, Norway
x 23

Re: Ogredeps - freeimage issue - windows

Post by hedphelym »

Had a quick look at it this morning, it was easy to fix in the 2.3 branch,

change line 226 in OgreString.h from:

Code: Select all

typedef stdext::hash_compare< _StringBase, std::less< _StringBase > > _StringHash;

to:

Code: Select all

typedef std::hash<_StringBase> _StringHash;

So something is going wrong with the define that's there.

Code: Select all

#elif !defined( _STLP_HASH_FUN_H )
   typedef stdext::hash_compare< _StringBase, std::less< _StringBase > > _StringHash;
#else
    typedef std::hash< _StringBase > _StringHash;
#endif

After making sure it uses the correct typedef I can compile it fine with 2022 compiler and its now working, I'll check with 2017 compiler next.