如何解决在 windows 上编译 wxWidgets 时出现致命错误 C1083
https://github.com/kyledavis124/guide/tree/refactor
我正在尝试将 wxWidgets 作为子目录添加到我的项目中。我不断收到错误,
"C:\Program Files (x86)\JetBrains\CLion 2021.1.3\bin\cmake\win\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - NMake Makefiles" C:\Project\guide
-- cotire 1.8.0 loaded.
-- Which libraries should wxWidgets use?
wxUSE_STL: OFF (use C++ STL classes)
wxUSE_REGEX: builtin (enable support for wxRegEx class)
wxUSE_ZLIB: builtin (use zlib for LZW compression)
wxUSE_EXPAT: builtin (use expat for XML parsing)
wxUSE_LIBJPEG: builtin (use libjpeg (JPEG file format))
wxUSE_LIBPNG: builtin (use libpng (PNG image format))
wxUSE_LIBTIFF: builtin (use libtiff (TIFF file format))
wxUSE_LIBLZMA: OFF (use liblzma for LZMA compression)
-- Configured wxWidgets 3.1.5 for Windows-10.0.19043
Min OS Version required at runtime: Windows Vista / Windows Server 2008
Which GUI toolkit should wxWidgets use? msw
Should wxWidgets be compiled into single library? OFF
Should wxWidgets be linked as a shared library? ON
Should wxWidgets support Unicode? ON
What wxWidgets compatibility level should be used? 3.0
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Project/guide/build
Problems were encountered while collecting compiler information:
C:\Users\kyled\AppData\Local\Temp\compiler-file3714472391677385802: Fatal error C1083: Cannot open include file: 'C:\Project\guide\build\vendor\wxwidgets\libs\adv\cotire\wxadv_CXX_prefix.hxx': No such file or directory
C:\Users\kyled\AppData\Local\Temp\compiler-file3714472391677385802: Fatal error C1083: Cannot open include file: 'C:\Project\guide\build\vendor\wxwidgets\libs\aui\cotire\wxaui_CXX_prefix.hxx': No such file or directory
C:\Users\kyled\AppData\Local\Temp\compiler-file3714472391677385802: Fatal error C1083: Cannot open include file: 'C:\Project\guide\build\vendor\wxwidgets\libs\base\cotire\wxbase_CXX_prefix.hxx': No such file or directory
C:\Users\kyled\AppData\Local\Temp\compiler-file3714472391677385802: Fatal error C1083: Cannot open include file: 'C:\Project\guide\build\vendor\wxwidgets\libs\core\cotire\wxcore_CXX_prefix.hxx': No such file or directory
C:\Users\kyled\AppData\Local\Temp\compiler-file3714472391677385802: Fatal error C1083: Cannot open include file: 'C:\Project\guide\build\vendor\wxwidgets\libs\gl\cotire\wxgl_CXX_prefix.hxx': No such file or directory
C:\Users\kyled\AppData\Local\Temp\compiler-file3714472391677385802: Fatal error C1083: Cannot open include file: 'C:\Project\guide\build\vendor\wxwidgets\libs\html\cotire\wxhtml_CXX_prefix.hxx': No such file or directory
C:\Users\kyled\AppData\Local\Temp\compiler-file3714472391677385802: Fatal error C1083: Cannot open include file: 'C:\Project\guide\build\vendor\wxwidgets\libs\media\cotire\wxmedia_CXX_prefix.hxx': No such file or directory
C:\Users\kyled\AppData\Local\Temp\compiler-file3714472391677385802: Fatal error C1083: Cannot open include file: 'C:\Project\guide\build\vendor\wxwidgets\libs\net\cotire\wxnet_CXX_prefix.hxx': No such file or directory
C:\Users\kyled\AppData\Local\Temp\compiler-file3714472391677385802: Fatal error C1083: Cannot open include file: 'C:\Project\guide\build\vendor\wxwidgets\libs\propgrid\cotire\wxpropgrid_CXX_prefix.hxx': No such file or directory
C:\Users\kyled\AppData\Local\Temp\compiler-file3714472391677385802: Fatal error C1083: Cannot open include file: 'C:\Project\guide\build\vendor\wxwidgets\libs\qa\cotire\wxqa_CXX_prefix.hxx': No such file or directory
C:\Users\kyled\AppData\Local\Temp\compiler-file3714472391677385802: Fatal error C1083: Cannot open include file: 'C:\Project\guide\build\vendor\wxwidgets\libs\ribbon\cotire\wxribbon_CXX_prefix.hxx': No such file or directory
C:\Users\kyled\AppData\Local\Temp\compiler-file3714472391677385802: Fatal error C1083: Cannot open include file: 'C:\Project\guide\build\vendor\wxwidgets\libs\richtext\cotire\wxrichtext_CXX_prefix.hxx': No such file or directory
C:\Users\kyled\AppData\Local\Temp\compiler-file3714472391677385802: Fatal error C1083: Cannot open include file: 'C:\Project\guide\build\vendor\wxwidgets\libs\stc\cotire\wxscintilla_CXX_prefix.hxx': No such file or directory
C:\Users\kyled\AppData\Local\Temp\compiler-file3714472391677385802: Fatal error C1083: Cannot open include file: 'C:\Project\guide\build\vendor\wxwidgets\libs\stc\cotire\wxstc_CXX_prefix.hxx': No such file or directory
C:\Users\kyled\AppData\Local\Temp\compiler-file3714472391677385802: Fatal error C1083: Cannot open include file: 'C:\Project\guide\build\vendor\wxwidgets\libs\webview\cotire\wxwebview_CXX_prefix.hxx': No such file or directory
C:\Users\kyled\AppData\Local\Temp\compiler-file3714472391677385802: Fatal error C1083: Cannot open include file: 'C:\Project\guide\build\vendor\wxwidgets\libs\xml\cotire\wxxml_CXX_prefix.hxx': No such file or directory
C:\Users\kyled\AppData\Local\Temp\compiler-file3714472391677385802: Fatal error C1083: Cannot open include file: 'C:\Project\guide\build\vendor\wxwidgets\libs\xrc\cotire\wxxrc_CXX_prefix.hxx': No such file or directory
[Finished]
我如何让它发挥作用?
cmake_minimum_required(VERSION 3.6 FATAL_ERROR)
project(guide LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_required ON)
set(wxWidgets_ROOT_DIR ${PROJECT_SOURCE_DIR}/vendor/wxwidgets)
set(wxWidgets_LIB_DIR ${PROJECT_SOURCE_DIR}/vendor/wxwidgets/lib/vc_x64_lib)
set(wxWidgets_INCLUDE_Dirs ${PROJECT_SOURCE_DIR}/vendor/wxwidgets/include)
set(wxWidgets_CONfigURATION msw)
add_subdirectory(vendor)
add_subdirectory(Tests)
add_subdirectory(src)
我确定错误必须在 CMakeLists 文件中。我是不是忘记了什么?
我在 Visual Studio 2019 编译器中使用 CMakeLists。我的 IDE 是 CLion。我在 Windows 上,但这应该在所有平台上构建。
我想将 wxWidgets 的源代码添加到我的项目的子目录中。这样,当有人签出我的项目时,如果他们没有 wxWidgets,它就会构建它。
编辑:
我设法通过从根 CMakeLists.txt 文件中删除 add_subdirectory(vendor)
来解决我的问题。它现在可以正确编译和运行。
解决方法
我通过从根 CMakeList.txt 文件中删除 def shellCommand(List cmd) {
来修复错误。我手动构建 wxWidgets。我认为 add_subdirectoy 试图构建 wxWidgets 但我已经这样做了。我读了@igor 的评论,提到我正在重新生成 wxWidgets,这让我找到了这个解决方案。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。