dhewm / dhewm3

dhewm 3 main repository
https://dhewm3.org/
GNU General Public License v3.0
1.75k stars 341 forks source link

Microsoft Foundation Classes for C++ not found when trying to build with tools on VS 2017 #272

Open TheEnbyWitch opened 4 years ago

TheEnbyWitch commented 4 years ago
PS X:\Games\dhewm3\neo> cmake -G "Visual Studio 15 2017" -DDHEWM3LIBS=X:/Games/dhewm3-libs/x86_64-w64-mingw32 -DTOOLS=ON  .
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.18363.
CMake Error at CMakeLists.txt:171 (message):
  MFC ('Microsoft Foundation Classes for C++') couldn't be found, but is
  needed for TOOLS!

CMake Error at CMakeLists.txt:172 (message):
  If you're using VS2013, you'll also need the 'Multibyte MFC Library for
  Visual Studio 2013':
  https://www.microsoft.com/en-us/download/details.aspx?id=40770 (VS2015 and
  2017 include that in the default MFC package)

-- Configuring incomplete, errors occurred!
See also "X:/Games/dhewm3/neo/CMakeFiles/CMakeOutput.log".
See also "X:/Games/dhewm3/neo/CMakeFiles/CMakeError.log".
PS X:\Games\dhewm3\neo>

For the record, I have MFC installed.

DanielGibson commented 4 years ago

I've never tried this with 64bit (amd64/x86_64/x64 - yes, everyone who made up the alternative names to amd64 should be shot).

Anyway, make sure you have MFC installed in the right bitness I also suggest using cmake-gui instead of cmake on the commandline, that way you can select the target VS version and the target architecture etc by clicking (setting DHEWM3LIBS is a bit annoying then, you gotta use the [+ Add Entry] button)

TheEnbyWitch commented 4 years ago

image Already have it installed. Using the CMake GUI doesn't change much though.

DanielGibson commented 4 years ago

Weird - this did work when I tried it a while ago, also with VS2017.. Does it work if you build as 32bit (with adjusted DHEWM3LIBS path of course)?

TheEnbyWitch commented 4 years ago

Building as 32-bit doesn't work either, same error :/

DanielGibson commented 4 years ago

Do you also have latest CMake? (in case the find_package(MFC) in your version is broken for some reason)

TheEnbyWitch commented 4 years ago

Updating CMake didnt work either.

I still think it might be CMake related though, but I have no idea what to do to fix it.

DanielGibson commented 4 years ago

I'll try to reproduce it later

Pretty sure it's cmake related, this error message happens if find_package(MFC) failed - I don't think there's much my cmake file could do wrong at that point

DanielGibson commented 4 years ago

I couldn't reproduce it :-/ I even updated VS (it says "Version 15.9.19" now) and CMake - it works for both Win32 and x64.

Can you try setting Options -> Debug Output in cmake-gui? I get the following output when it looks for MFC then:

``` ... Found Threads: TRUE Found SDL2: C:/dev/dhewm3-libs/i686-w64-mingw32/lib/SDL2.lib Looking for MFC CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.14/Modules/FindMFC.cmake:36 (try_compile): Policy CMP0066 is not set: Honor per-config flags in try_compile() source-file signature. Run "cmake --help-policy CMP0066" for policy details. Use the cmake_policy command to set the policy and suppress this warning. For compatibility with older versions of CMake, try_compile is not honoring caller config-specific compiler flags (e.g. CMAKE_C_FLAGS_DEBUG) in the test project. Call Stack (most recent call first): CMakeLists.txt:168 (find_package) This warning is for project developers. Use -Wno-dev to suppress it. CMake Warning (dev) at C:/Program Files/CMake/share/cmake-3.14/Modules/FindMFC.cmake:36 (try_compile): Policy CMP0056 is not set: Honor link flags in try_compile() source-file signature. Run "cmake --help-policy CMP0056" for policy details. Use the cmake_policy command to set the policy and suppress this warning. For compatibility with older versions of CMake, try_compile is not honoring caller link flags (e.g. CMAKE_EXE_LINKER_FLAGS) in the test project. Call Stack (most recent call first): CMakeLists.txt:168 (find_package) This warning is for project developers. Use -Wno-dev to suppress it. Looking for MFC - found ... ```
TheEnbyWitch commented 4 years ago

what the hell

Determining if the include file pthread.h exists failed with the following output:
Change Dir: X:/Games/dhewm3/neo/CMakeFiles/CMakeTmp

Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/MSBuild/15.0/Bin/MSBuild.exe cmTC_a93fe.vcxproj /p:Configuration=Debug /p:Platform=Win32 /p:VisualStudioVersion=15.0 /v:m 
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Framework

Copyright (C) Microsoft Corporation. All rights reserved.

  Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27024.1 for x86

  Copyright (C) Microsoft Corporation.  All rights reserved.

  cl /c /I"X:\Games\dhewm3-libs\x86_64-w64-mingw32\include" /I"X:\Source\vcpkg\installed\x86-windows\include" /Zi /W3 /WX- /diagnostics:classic /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_a93fe.dir\Debug\\" /Fd"cmTC_a93fe.dir\Debug\vc141.pdb" /Gd /TC /analyze- /errorReport:queue X:\Games\dhewm3\neo\CMakeFiles\CMakeTmp\CheckIncludeFile.c

  CheckIncludeFile.c

X:\Games\dhewm3\neo\CMakeFiles\CMakeTmp\CheckIncludeFile.c(1): fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory [X:\Games\dhewm3\neo\CMakeFiles\CMakeTmp\cmTC_a93fe.vcxproj]

Determining if MFC exists failed with the following output:
Change Dir: X:/Games/dhewm3/neo/CMakeFiles/CMakeTmp

Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/MSBuild/15.0/Bin/MSBuild.exe cmTC_06e61.vcxproj /p:Configuration=Debug /p:Platform=Win32 /p:VisualStudioVersion=15.0 /v:m 
Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Framework

Copyright (C) Microsoft Corporation. All rights reserved.

  Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27024.1 for x86

  Copyright (C) Microsoft Corporation.  All rights reserved.

  cl /c /I"X:\Source\vcpkg\installed\x86-windows\include" /Zi /W3 /WX- /diagnostics:classic /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"cmTC_06e61.dir\Debug\\" /Fd"cmTC_06e61.dir\Debug\vc141.pdb" /Gd /TP /analyze- /errorReport:queue X:\Games\dhewm3\neo\CMakeFiles\CMakeTmp\CheckIncludeFile.cxx

  CheckIncludeFile.cxx

X:\Games\dhewm3\neo\CMakeFiles\CMakeTmp\CheckIncludeFile.cxx(1): fatal error C1083: Cannot open include file: 'afxwin.h': No such file or directory [X:\Games\dhewm3\neo\CMakeFiles\CMakeTmp\cmTC_06e61.vcxproj]