[Solved][1.9] Mingw5.3 32bits GetModuleHandleEx

Problems building or running the engine, queries about how to use features etc.
Post Reply
User avatar
Suryavarman
Halfling
Posts: 41
Joined: Wed Dec 30, 2009 5:22 pm
Location: France
x 1
Contact:

[Solved][1.9] Mingw5.3 32bits GetModuleHandleEx

Post by Suryavarman »

I try to build ogre 1.9 with my gdeps project :
http://gdeps.org/
https://sourceforge.net/p/gdeps/mercuri ... re/ogre.py

At the moment i have this error to solve with Mingw 5.3 32bits (see http://www.mingw.org )
E:\..\GDeps\trunk\Projects\ogre\ogre\OgreMain\src\WIN32\OgreConfigDialog.cpp|49|error: 'GetModuleHandleEx' was not declared in this scope|
For this mingw version i have the winbase.h

Code: Select all

#if (_WIN32_WINNT >= 0x0501)
WINBASEAPI BOOL WINAPI GetModuleHandleExA(DWORD,LPCSTR,HMODULE*);
WINBASEAPI BOOL WINAPI GetModuleHandleExW(DWORD,LPCWSTR,HMODULE*);
#endif

...

#if (_WIN32_WINNT >= 0x0501)
#define GetModuleHandleEx GetModuleHandleExA
#endif
To understand why, i would to know, where is the #include to include winbase.h ?
Last edited by Suryavarman on Thu Aug 31, 2017 5:10 pm, edited 5 times in total.

« Let us be firm, pure and faithful; at the end of our labours, there is the greatest glory in the world, that of the humans who have not given in. »
«Soyons fermes, purs et fidèles; au bout de nos peines il y a la plus grande gloire du monde, celle des Hommes qui n'ont pas cédé. »
CDG

User avatar
Suryavarman
Halfling
Posts: 41
Joined: Wed Dec 30, 2009 5:22 pm
Location: France
x 1
Contact:

Re: Ogre 1.9 Mingw GetModuleHandleEx

Post by Suryavarman »

I have find the includes path:

OgreMain\src\WIN32\OgreConfigDialog.cpp
#include "OgreConfigDialog.h"
OgreMain\include\OgreConfigDialog.h
#elif OGRE_PLATFORM == OGRE_PLATFORM_WIN32
# include "WIN32/OgreConfigDialogImp.h"
OgreMain\include\WIN32\OgreConfigDialogImp.h
#include <windows.h>
x:\MinGW\include\windows.h
#include <winbase.h>

« Let us be firm, pure and faithful; at the end of our labours, there is the greatest glory in the world, that of the humans who have not given in. »
«Soyons fermes, purs et fidèles; au bout de nos peines il y a la plus grande gloire du monde, celle des Hommes qui n'ont pas cédé. »
CDG

User avatar
Suryavarman
Halfling
Posts: 41
Joined: Wed Dec 30, 2009 5:22 pm
Location: France
x 1
Contact:

Re: Ogre 1.9 Mingw5.3 32bits GetModuleHandleEx

Post by Suryavarman »

I think i have find the problem but not the why ?

I'm on windows 7:

on c:\MinGW\include\sdkddkver.h the value for windows 7 it's that:

Code: Select all

#define _WIN32_WINNT_WIN7	0x0601	
But the value for _WIN32_WINNT it's 0x0500 (windows 2000)

Code: Select all

#ifndef _WIN32_WINNT
# ifdef WINVER
#  define _WIN32_WINNT WINVER
# else
#  ifdef _WARN_DEFAULTS
#   warning "Assuming default setting of _WIN32_WINNT_WIN2K for _WIN32_WINNT"
#  endif
#  define _WIN32_WINNT _WIN32_WINNT_WIN2K
# endif
#endif
In sdkddkver.h I haven't find a line with

Code: Select all

define _WIN32_WINNT _WIN32_WINNT_WIN7	
Some links about the this problem:
https://stackoverflow.com/questions/544 ... -7-machine
https://stackoverflow.com/questions/152 ... -windows-7
https://stackoverflow.com/questions/300 ... with-boost

« Let us be firm, pure and faithful; at the end of our labours, there is the greatest glory in the world, that of the humans who have not given in. »
«Soyons fermes, purs et fidèles; au bout de nos peines il y a la plus grande gloire du monde, celle des Hommes qui n'ont pas cédé. »
CDG

User avatar
Suryavarman
Halfling
Posts: 41
Joined: Wed Dec 30, 2009 5:22 pm
Location: France
x 1
Contact:

Re: Ogre 1.9 Mingw5.3 32bits GetModuleHandleEx

Post by Suryavarman »

I have find the origin.
ogre\CMakeLists.txt
line 144:

Code: Select all

if (MINGW)
  add_definitions(-D_WIN32_WINNT=0x0500)
  # set architecture to i686, since otherwise some versions of MinGW can't link
  # the atomic primitives
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i686")
  # Fpermissive required to let some "non-standard" casting operations in the plugins pass
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
  # disable this optimisation because it breaks release builds (reason unknown)
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-tree-slp-vectorize")
  # Ignore some really annoying warnings which also happen in dependencies
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=cast-qual -Wno-unused-local-typedefs")
endif ()
Now i call cmake with -D_WIN32_WINNT = 0x0501 (windows xp) and not with windows seven value to keep the compatibility with XP and vista.


EDIT:
Error....
ogre\CodeBlocks\Mingw_32\release_dynamic\CMakeCache.txt

Code: Select all

//No help, variable specified on the command line.
_WIN32_WINNT:UNINITIALIZED=0x0501
EDIT:
Ok i'm stupid it's just an add_defitions without cmake variable. It's a bug from ogre CMakelists.txt. I'm oblige to edit the CMakeLists.txt.

« Let us be firm, pure and faithful; at the end of our labours, there is the greatest glory in the world, that of the humans who have not given in. »
«Soyons fermes, purs et fidèles; au bout de nos peines il y a la plus grande gloire du monde, celle des Hommes qui n'ont pas cédé. »
CDG

User avatar
Suryavarman
Halfling
Posts: 41
Joined: Wed Dec 30, 2009 5:22 pm
Location: France
x 1
Contact:

Re: Ogre 1.9 Mingw5.3 32bits GetModuleHandleEx

Post by Suryavarman »

« Let us be firm, pure and faithful; at the end of our labours, there is the greatest glory in the world, that of the humans who have not given in. »
«Soyons fermes, purs et fidèles; au bout de nos peines il y a la plus grande gloire du monde, celle des Hommes qui n'ont pas cédé. »
CDG

Post Reply