IsWow64Process was not declared in this scope

Support for running, installing or compiling OpenMW

Before you submit a bug report for the first time, please read: Bug reporting guidelines
Locked
CounterPillow
Posts: 5
Joined: 22 Apr 2012, 14:06

IsWow64Process was not declared in this scope

Post by CounterPillow » 22 Apr 2012, 14:12

Hello,
after successfully compiling Ogre3D 1.8 on Windows with mingw (took me 5 hours to get the configuration right), and compiling boost, as well as getting all of the other dependencies, there is one last problem left to solve. This seems tricky because I haven't found anything even remotely useful on google about it. :(
When building openmw, it spits me out this:

Code: Select all

openmw\components\files\windowspath.cpp:78:50: error: 'IsWow64Process' was not declared in this scope
I've tried adding the Windows SDK Include dir to PATH (and of course restarting my shell), but I still can't build it. :(
I'm running low on food, water and motivation. Building stuff on windows is horrible. :/

User avatar
Ace (SWE)
Posts: 802
Joined: 15 Aug 2011, 14:56

Re: IsWow64Process was not declared in this scope

Post by Ace (SWE) » 23 Apr 2012, 14:54

Are you by any chance running a 32-bit windows?

CounterPillow
Posts: 5
Joined: 22 Apr 2012, 14:06

Re: IsWow64Process was not declared in this scope

Post by CounterPillow » 24 Apr 2012, 13:25

Not 32bit Windows, but mingw32. IsWow64Process should be defined in MinGW's w32api, which should be included in windows.h. Since windows.h is included in windowspath.cpp, it's either using a wrong windows.h or something. I did check my %PATH%, also put mingw's include directory in there, checked whether there was some windows SDK/visual studio stuff in there (there wasn't), but it's not really helping.

I have successfully built OpenMW with MinGW once.

EDIT: Okay, some more: Manually adding the MinGW include directory to CXX flags didn't help.

Code: Select all

cd C:\Users\myname\openmw\bin\components && D:\MinGW\bin\g++.exe   -DBOOST_ALL_
NO_LIB -Wno-missing-field-initializers -ID:\MinGW\include -IC:\Users\myname\ope
nmw\. -ID:\Projekte\ogre_1.8_bin\include -ID:\Projekte\ogre_1.8_bin\include\OGRE
 -ID:\Projekte\ogre_1.8_bin\include\OGRE\Ogre -ID:\Projekte\ogre_1.8_bin\include
\OGRE\OGRE -ID:\Projekte\ogre_1.8_bin\Components\Terrain\include -ID:\Projekte\o
gre_1.8_bin\Dependencies\include\OIS -ID:\Projekte\ogre_1.8_bin\Dependencies\inc
lude -ID:\Projekte\boost_1_49_0 -IC:\Users\myname\openmw\platform -ID:\OPENAL~1
.1SD\include -IC:\Users\myname\openmw\libs -ID:\BULLET_PHYSICS\include\bullet
 -Wall -Wextra -Wno-unused-parameter -Wno-reorder -Wno-ignored-qualifiers -Wno-u
nused-but-set-parameter -o CMakeFiles\components.dir\files\windowspath.cpp.obj -
c C:\Users\myname\openmw\components\files\windowspath.cpp
C:\Users\myname\openmw\components\files\windowspath.cpp:11:0: warning: ignoring
 #pragma comment  [-Wunknown-pragmas]
C:\Users\myname\openmw\components\files\windowspath.cpp: In member function 'bo
ost::filesystem3::path Files::WindowsPath::getInstallPath() const':
C:\Users\myname\openmw\components\files\windowspath.cpp:78:50: error: 'IsWow64P
rocess' was not declared in this scope
make[2]: *** [components/CMakeFiles/components.dir/files/windowspath.cpp.obj] Er
ror 1
make[2]: Leaving directory `c:/Users/myname/openmw/bin'
make[1]: *** [components/CMakeFiles/components.dir/all] Error 2
make[1]: Leaving directory `c:/Users/myname/openmw/bin'
make: *** [all] Error 2
Some more stuff:

Code: Select all

[email protected] /d/MinGW/include
$ grep -r -i "IsWow64Process" *
winbase.h:WINBASEAPI BOOL WINAPI IsWow64Process(HANDLE,PBOOL);

[email protected] /d/MinGW/include
$ grep -r -i "winbase.h" *
ddk/ntapi.h:#include <winbase.h>
ddk/ntapi.h:/* also in winbase.h */
ddk/ntapi.h:/* end winbase.h */
ddk/ntapi.h:/* also in winbase.h */
ddk/ntapi.h:/* end winbase.h */
ddk/winddk.h:   but are also exported from kernel32.dll and declared in winbase.
h as
winbase.h:#ifndef _WINBASE_H
winbase.h:#define _WINBASE_H
winbase.h:#endif /* _WINBASE_H */
windows.h:#include <winbase.h>
winerror.h:#ifndef WAIT_TIMEOUT /* also in winbase.h */
You can see how it is defined in winbase.h, which is included in windows.h, which should be included into windowspath.cpp.

EDIT2: Even more.

Code: Select all

[email protected] /d/MinGW/lib
$ grep -i -r "IsWow64Process" *
Binary file libkernel32.a matches
As you can see it is in libkernel32.a, and I've got that one in my standard libraries variable in CMake. Not sure if this is even related, it's not finding the definition, not missing the library.

User avatar
Ace (SWE)
Posts: 802
Joined: 15 Aug 2011, 14:56

Re: IsWow64Process was not declared in this scope

Post by Ace (SWE) » 25 Apr 2012, 01:02

Just for fun, try adding the winbase.h file to the windowspath includes.
I haven't used MinGW myself so I'm probably not of much help with it.

CounterPillow
Posts: 5
Joined: 22 Apr 2012, 14:06

Re: IsWow64Process was not declared in this scope

Post by CounterPillow » 25 Apr 2012, 01:22

Tried that, didn't work. Hmm. I'm curious whether those headers get included at all. I mean, there is a huge "FIXME" right below them. :P

CounterPillow
Posts: 5
Joined: 22 Apr 2012, 14:06

Re: IsWow64Process was not declared in this scope

Post by CounterPillow » 17 Jun 2012, 19:28

Just pushing this again. The issue still exsists, I've looked at it again and it is more than obscure. First of all, all the necessary headers should be included. I'm not too familiar with C++, so I'm guessing that the namespace-stuff below is not messing with the included functions at all, right?
And even if, it should not be different on GCC than it is with MSVC.

So I have written a small test to check whether a simple cpp program could find IsWow64Process, but nope, it can't. Even with included windows.h.
So it's definitely a problem with my environment, I'm looking into it some time in the future.

EDIT: Trying to uninstall the Windows SDK right now. It shouldn't be interfering with MinGW since it's not in PATH (anymore), but who knows what kind of magic is at work here.

EDIT2: Not even giving it the absolute path to windows.h works. Something is really broken on my side. Horribly, horribly broken. :[

EDIT3: NOPE IT ISN'T! :D SOOOOLVED!

Okay, this is the solution: Apparently, in order to use Windows headers, you need to define _WIN32_WINNT to at least 0x501.
So to get it to compile, in cmake, add -D_WIN32_WINNT=0x501 to CMAKE_CXX_FLAGS, which should do the trick.

Sorry for using this thread for mainly thinking out loud, but I guess this will help people who experience the same problems in the future.

Locked

Who is online

Users browsing this forum: No registered users and 3 guests