我們在 Windows 10 上使用 Visual Studio 2019、Qt5.12.3 和 qwt-6.1.2(Qwt 是 Qt GUI 應用程式框架的圖形擴展)。我們的解決方案傳統上是一個僅限 3??2 位的應用程式,但我們已經收到請求以 32 位和 64 位交付它。
我的問題特別與 64 位 qwt-6.1.2 有關。
32 位版本的 qwt-6.1.2 編譯沒有問題,以下腳本在批處理檔案中運行(不,我們不能使用 power shell,因為 power shell 腳本在我們的網路上被禁用)。
cd\resources
tar -xf qwt-6.1.2.zip
rem del qwt-6.1.2.zip
cd\resources\qwt-6.1.2
REM Add the x86 path to compile qwt-6.1.2
SET PATH=%PATH%;C:\Qt\Qt5.12.3\5.12.3\msvc2017\bin;
REM Create qwt make files
REM 1. Set up x86 environment
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars32.bat"
REM 2. Create x86 make files
qmake qwt.pro
REM 3. Compile the binaries for x86 version of qwt-6.1.2
nmake
當嘗試使用下面的腳本編譯 64 位相同的源代碼時,我收到數百個聯結器錯誤
REM Add the x64 path to compile qwt-6.1.2
SET PATH=%PATH%;C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\bin
REM Create qwt make files
REM 1. Set up x64 environment
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
REM 2. Clean up the old qmake data for rebuild to x64
del c:\resources\qwt-6.1.2\.qmake.stash
del c:\resources\qwt-6.1.2\Makefile
REM 3. Create x86 make files
qmake qwt.pro
REM 4. Compile the binaries for x86 version of qwt-6.1.2
nmake
linking ..\lib\qwt.dll
Creating library ..\lib\qwt.lib and object ..\lib\qwt.exp
qwt_dial.obj : error LNK2001: unresolved external symbol "void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))" (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
qwt_knob.obj : error LNK2001: unresolved external symbol "void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))" (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
qwt_slider.obj : error LNK2001: unresolved external symbol "void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))" (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
qwt_thermo.obj : error LNK2001: unresolved external symbol "void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))" (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
qwt_abstract_slider.obj : error LNK2001: unresolved external symbol "void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))" (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
qwt_abstract_scale.obj : error LNK2001: unresolved external symbol "void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))" (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
qwt_analog_clock.obj : error LNK2001: unresolved external symbol "void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))" (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
qwt_compass.obj : error LNK2001: unresolved external symbol "void __stdcall `eh vector copy constructor iterator'(void *,void *,unsigned int,unsigned int,void (__thiscall*)(void *,void *),void (__thiscall*)(void *))" (??__C@YGXPAX0IIP6EX00@ZP6EX0@Z@Z)
等等等等......以
LINK : error LNK2001: unresolved external symbol __DllMainCRTStartup@12
LINK : error LNK2001: unresolved external symbol __load_config_used
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\lib\x64\msvcprt.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\lib\x64\MSVCRT.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\um\x64\uuid.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
..\lib\qwt.dll : fatal error LNK1120: 47 unresolved externals
NMAKE : fatal error U1077: 'echo' : return code '0x460'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
It appears that somewhere, something is referencing some 32-bit libraries, but I can't find any documentation (I've been searching for a few days) that specifically deal with compiling a 64-bit version of qwt-6.1.2 (or any of the related qwt versions) on Windows.
Any guidance in finding the 64-bit sources, or instructions on how to compile for 64-bit would be greatly appreciated.
uj5u.com熱心網友回復:
你錯過了一個電話nmake clean,所以有(即使是在一個新的qmake)32 位構建的剩余部分破壞了你的 64 位構建。
uj5u.com熱心網友回復:
根據@SebDieBln 的建議,我能夠構建 64 位版本。但是,還需要一個額外的步驟。
盡管我們可以運行“nmake clean”來清理 MS Build 資料,但沒有“qmake clean”來清理 qmake 構建資料。這是一個手動步驟。
下面是為 qwt-6.1.2 構建 32 位和 64 位二進制文??件的完整腳本,包括兩者之間的清理程序。
注意: 此程序不安裝 qwt-6.1.2,它只編譯 32 位和 64 位二進制文??件。
REM Create resources directory and extract qwt in said directory
cd\resources
tar -xf qwt-6.1.2.zip
REM Delete the zip file since it it no longer required
del qwt-6.1.2.zip
cd\resources\qwt-6.1.2
REM Add the x86 path to compile 32-bit qwt-6.1.2 binaries
SET PATH=%PATH%;C:\Qt\Qt5.12.3\5.12.3\msvc2017\bin;
REM 1. Set up x86 environment
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars32.bat"
REM 2. Create x86 make files
qmake qwt.pro
REM 3. Compile the binaries for x86 version of qwt-6.1.2
nmake
REM Make a lib\lib32 directory
mkdir c:\resources\qwt-6.1.2\lib\lib32
REM Move the compiled files to the lib\lib32 directory
move c:\resources\qwt-6.1.2\lib\*.* c:\resources\qwt-6.1.2\lib\lib32\
REM Clean up the x86 make code
nmake clean
REM Clean up the old qmake data for rebuild to x64
del c:\resources\qwt-6.1.2\.qmake.stash
del c:\resources\qwt-6.1.2\Makefile*
del c:\resources\qwt-6.1.2\designer\Makefile*
rd /S /Q c:\resources\qwt-6.1.2\designer\moc
rd /S /Q c:\resources\qwt-6.1.2\designer\plugins
rd /S /Q c:\resources\qwt-6.1.2\designer\resources
del c:\resources\qwt-6.1.2\doc\Makefile*
del c:\resources\qwt-6.1.2\src\Makefile*
del c:\resources\qwt-6.1.2\textengines\Makefile*
REM Remove the x86 path variables to MSVC2017
SET PATH=%PATH:C:\Qt\Qt5.12.3\5.12.3\msvc2017\bin;=%
REM Add the x64 path to compile 64-bit qwt-6.1.2 binaries
SET PATH=%PATH%;C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\bin
REM 1. Set up x64 environment
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
REM 2. Create x86 make files
qmake qwt.pro
REM 3. Compile the binaries for x86 version of qwt-6.1.2
nmake
REM Make a lib\lib64 directory
mkdir c:\resources\qwt-6.1.2\lib\lib64
REM Move the compiled files to the lib\lib64 directory
move c:\resources\qwt-6.1.2\lib\*.* c:\resources\qwt-6.1.2\lib\lib64
REM Clean up the x64 make code
nmake clean
REM Clean up the x64 qmake data
del c:\resources\qwt-6.1.2\.qmake.stash
del c:\resources\qwt-6.1.2\Makefile*
del c:\resources\qwt-6.1.2\designer\Makefile*
rd /S /Q c:\resources\qwt-6.1.2\designer\moc
rd /S /Q c:\resources\qwt-6.1.2\designer\plugins
rd /S /Q c:\resources\qwt-6.1.2\designer\resources
del c:\resources\qwt-6.1.2\doc\Makefile*
del c:\resources\qwt-6.1.2\src\Makefile*
del c:\resources\qwt-6.1.2\textengines\Makefile*
REM Remove the x64 path variables to MSVC2017_64
SET PATH=%PATH:C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\bin;=%
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/388712.html
標籤:c qt command-line qwt
