问题描述
对于尝试在Windows上使用 g ++ (MSYS2 / MinGW)编译使用Google's Filament library和on the Microsoft website的C ++项目时遇到的问题,我一点都不了解。它只是向我吐出大量错误消息(请参见下面的摘录)。我的猜测是缺少MSVCRT,但我不确定。如果是这种情况,我是否应该告诉g ++该库将在运行时通过msvcrt.dll
动态提供,因此现在不关心引用?
main.cpp
#include <filament/Engine.h>
#include <filament/SwapChain.h>
#include <filament/Renderer.h>
#include <filament/View.h>
#include <utils/EntityManager.h>
int main()
{}
编译命令:
g++ \
-std=c++14 -pthread \
main.cpp \
-IE:/libraries/filament/1.8.1/include \
-IE:/libraries/sdl/2.0.12/x86_64-w64-mingw32/include \
-LE:/libraries/filament/1.8.1/lib/x86_64/mt \
`E:/libraries/sdl/2.0.12/x86_64-w64-mingw32/bin/sdl2-config --libs` \
-lfilament -lbackend -lbluegl -lbluevk -lfilabridge -lfilaflat -lutils -lgeometry -lsmol-v -libl \
-lpthread
它发出1233 KB的邮件。以下是一些摘录:
一开始会有一些太小,无法容纳所有值-错误:
In file included from E:/libraries/filament/1.8.1/include/backend/Platform.h:22,from E:/libraries/filament/1.8.1/include/filament/Engine.h:20,from main.cpp:2:
E:/libraries/filament/1.8.1/include/backend/DriverEnums.h:631:30: warning: 'filament::backend::SamplerParams::<unnamed union>::<unnamed struct>::filterMag' is too small to hold all values of 'enum class filament::backend::SamplerMagFilter'
631 | SamplerMagFilter filterMag : 1; //!< magnification filter (NEAREST)
| ^~~~~~~~~
E:/libraries/filament/1.8.1/include/backend/DriverEnums.h:632:30: warning: 'filament::backend::SamplerParams::<unnamed union>::<unnamed struct>::filterMin' is too small to hold all values of 'enum class filament::backend::SamplerMinFilter'
632 | SamplerMinFilter filterMin : 3; //!< minification filter (NEAREST)
| ^~~~~~~~~
(some more cut out)
接着有40行告诉我:
Warning: corrupt .drectve at end of def file
然后有许多不确定的未定义引用:
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:/libraries/filament/1.8.1/lib/x86_64/mt/bluegl.lib(bluegl.dir/Release/BlueGL.obj):(.text$x+0x8): undefined reference to `??1sentry@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA@XZ'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:/libraries/filament/1.8.1/lib/x86_64/mt/bluegl.lib(bluegl.dir/Release/BlueGL.obj):(.text$x+0x8): undefined reference to `??1_Sentry_base@?$basic_ostream@DU?$char_traits@D@std@@@std@@QEAA@XZ'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:/libraries/filament/1.8.1/lib/x86_64/mt/bluegl.lib(bluegl.dir/Release/BlueGL.obj):(.text$x+0x8): undefined reference to `??1locale@std@@QEAA@XZ'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:/libraries/filament/1.8.1/lib/x86_64/mt/bluegl.lib(bluegl.dir/Release/BlueGL.obj):(.text$x+0x8): undefined reference to `??1_Lockit@std@@QEAA@XZ'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: E:/libraries/filament/1.8.1/lib/x86_64/mt/bluegl.lib(bluegl.dir/Release/BlueGL.obj):(.text$x+0x8): undefined reference to `??1?$unique_ptr@V_Facet_base@std@@U?$default_delete@V_Facet_base@std@@@2@@std@@QEAA@XZ'
(many many many more)
其中一些:
undefined reference to `__CxxFrameHandler4'
这使我了解了MSVCRT理论。
我的g ++版本:
$ g++ --version
g++.exe (Rev2,Built by MSYS2 project) 9.2.0
copyright (C) 2019 Free Software Foundation,Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or fitness FOR A PARTIculaR PURPOSE.
适用于Windows的Binary Filament具有不同的lib版本:mt,md,mtd和mdd,{{3}}进行了解释。我认为mt版本意味着没有静态链接到MSVCRT,因此在编译过程中没有参考问题。也许我在这里误解了一些事情?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)