在我的项目中,我必须解决整数线性规划问题,因此我决定在我的Windows 7平台上将lp_solve solver package与Qt 4.8.4 mingw32编译器集成。我正在静态编译我的独立Qt应用程序。
我已经按照this建议将我的应用程序静态链接到lp_solve(隐式链接) - 我已经下载了提到的头文件,并将其路径包含在我的.pro文件中 - 我已经下载了liblpsolve55.lib文件并将库包含在我的.pro文件中。
添加到我的项目文件中:
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../../../Users/Abhishek/Downloads/lp_solve_5.5.2.0_dev_win32/ -lliblpsolve55
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../../../Users/Abhishek/Downloads/lp_solve_5.5.2.0_dev_win32/ -lliblpsolve55d
INCLUDEPATH += $$PWD/../../../../../../Users/Abhishek/Downloads/lp_solve_5.5.2.0_dev_win32
DEPENDPATH += $$PWD/../../../../../../Users/Abhishek/Downloads/lp_solve_5.5.2.0_dev_win32
win32:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../../../../../Users/Abhishek/Downloads/lp_solve_5.5.2.0_dev_win32/liblpsolve55.lib
else:win32:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../../../../../Users/Abhishek/Downloads/lp_solve_5.5.2.0_dev_win32/liblpsolve55d.lib
win32: LIBS += -L$$PWD/../../../../../../Users/Abhishek/Downloads/lp_solve_5.5.2.0_dev_win32/ -llpsolve55
INCLUDEPATH += $$PWD/../../../../../../Users/Abhishek/Downloads/lp_solve_5.5.2.0_dev_win32
DEPENDPATH += $$PWD/../../../../../../Users/Abhishek/Downloads/lp_solve_5.5.2.0_dev_win32
此外,Qt Autocomplete正在识别这些头文件。
但是,当我在代码中包含以下行时,会收到一堆警告和错误。
int demo()
{
lprec *lp;
lp = make_lp( 0, 4); // This line gives me errors
/*...*/
return(0);
}
编译器输出:
14:07:09: Running steps for project EZDraft...
14:07:09: Configuration unchanged, skipping qmake step.
14:07:09: Starting: "C:\mingw\bin\mingw32-make.exe"
C:/mingw/bin/mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory `C:/Qt/Qt5.0.0/Tools/QtCreator/bin/EZDraft-build-Unnamed_Microsoft_Windows_SDK_for_Windows_7_7_1_7600_0_30514_x86-Default_build_Debug'
g++ -static-libgcc -static-libstdc++ -static-libgcc -Wl,-s -Wl,-subsystem,windows -o release\PanelDraw.exe object_script.PanelDraw.Release -L"c:\Users\Abhishek\Downloads\qt-everywhere-opensource-src-4.8.4\qt-everywhere-opensource-src-4.8.4\lib" -lmingw32 -lqtmain release\myicon_res.o -LC:/Qt/Qt5.0.0/Tools/QtCreator/bin/EZDraft_10_09_2013/../../../../../../Users/Abhishek/Downloads/lp_solve_5.5.2.0_dev_win32/ -lliblpsolve55 -LC:/Qt/Qt5.0.0/Tools/QtCreator/bin/EZDraft_10_09_2013/../../../../../../Users/Abhishek/Downloads/lp_solve_5.5.2.0_dev_win32/ -llpsolve55 -lQtGui -lQtNetwork -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lmsimg32 -lQtCore -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:uuid.lib ' unrecognized
Warning: .drectve `-defaultlib:LIBCMT ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
C:/Qt/Qt5.0.0/Tools/QtCreator/bin/EZDraft_10_09_2013/../../../../../../Users/Abhishek/Downloads/lp_solve_5.5.2.0_dev_win32//liblpsolve55.lib(lp_lib.obj):../lp_lib.c:(.text[_performiteration]+0x46f): undefined reference to `_allrem'
C:/Qt/Qt5.0.0/Tools/QtCreator/bin/EZDraft_10_09_2013/../../../../../../Users/Abhishek/Downloads/lp_solve_5.5.2.0_dev_win32//liblpsolve55.lib(commonlib.obj):../shared/commonli:(.text[_gcd]+0xac): undefined reference to `_alldiv'
C:/Qt/Qt5.0.0/Tools/QtCreator/bin/EZDraft_10_09_2013/../../../../../../Users/Abhishek/Downloads/lp_solve_5.5.2.0_dev_win32//liblpsolve55.lib(commonlib.obj):../shared/commonli:(.text[_gcd]+0xb9): undefined reference to `_allmul'
C:/Qt/Qt5.0.0/Tools/QtCreator/bin/EZDraft_10_09_2013/../../../../../../Users/Abhishek/Downloads/lp_solve_5.5.2.0_dev_win32//liblpsolve55.lib(lp_MPS.obj):../lp_MPS.c:(.text[_MPS_readex@20]+0xc): undefined reference to `_chkstk'
C:/Qt/Qt5.0.0/Tools/QtCreator/bin/EZDraft_10_09_2013/../../../../../../Users/Abhishek/Downloads/lp_solve_5.5.2.0_dev_win32//liblpsolve55.lib(lp_utils.obj):../lp_utils.c:(.text[_roundToPrecision]+0xd1): undefined reference to `_allmul'
C:/Qt/Qt5.0.0/Tools/QtCreator/bin/EZDraft_10_09_2013/../../../../../../Users/Abhishek/Downloads/lp_solve_5.5.2.0_dev_win32//liblpsolve55.lib(lp_price.obj):../lp_price.c:(.text[_makePriceLoop]+0x2e): undefined reference to `_allrem'
C:/Qt/Qt5.0.0/Tools/QtCreator/bin/EZDraft_10_09_2013/../../../../../../Users/Abhishek/Downloads/lp_solve_5.5.2.0_dev_win32//liblpsolve55.lib(lp_params.obj):../lp_params.c:(.text[_write_params@12]+0x6): undefined reference to `_chkstk'
C:/Qt/Qt5.0.0/Tools/QtCreator/bin/EZDraft_10_09_2013/../../../../../../Users/Abhishek/Downloads/lp_solve_5.5.2.0_dev_win32//liblpsolve55.lib(lp_params.obj):../lp_params.c:(.text[_write_params1]+0x6): undefined reference to `_chkstk'
C:/Qt/Qt5.0.0/Tools/QtCreator/bin/EZDraft_10_09_2013/../../../../../../Users/Abhishek/Downloads/lp_solve_5.5.2.0_dev_win32//liblpsolve55.lib(lp_params.obj):../lp_params.c:(.text[_read_params@12]+0x6): undefined reference to `_chkstk'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [release\PanelDraw.exe] Error 1
mingw32-make[1]: Leaving directory `C:/Qt/Qt5.0.0/Tools/QtCreator/bin/EZDraft-build-Unnamed_Microsoft_Windows_SDK_for_Windows_7_7_1_7600_0_30514_x86-Default_build_Debug'
mingw32-make: *** [release] Error 2
14:07:15: The process "C:\mingw\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project EZDraft (kit: Unnamed-Microsoft Windows SDK for Windows 7 (7.1.7600.0.30514) (x86))
When executing step 'Make'
有关如何解决上述错误的任何指导都非常有用。我已经搜索了上述错误,但我无法得到解决方案。
由于
答案 0 :(得分:0)
从这个link来看,使用mingW我将不得不为我的特定环境重新编译lpsolve .lib。
我通过使用共享DLL(隐式链接)过程解决了这个问题。它编译没有任何错误。
答案 1 :(得分:0)
我也遇到了这个问题。我用Qt MinGW重新编译了lpsolve lib。 (版本Qt 5.5,MinGW 4.9.2)文件可以在以下网址下载:
视窗 - https://drive.google.com/file/d/0B_c8WhuA6Nq1Ynk0WmhaNXp0Uk0/view?usp=sharing 的Unix - https://drive.google.com/file/d/0B_c8WhuA6Nq1RWRWS1AxRnhsSDQ/view?usp=sharing
我的链接代码(静态):
#
# LP Solver
#
unix {
INCLUDEPATH += $$PWD/../MarbleCommon/MinNearConv/lp_solver_unix
DEPENDPATH += $$PWD/../MarbleCommon/MinNearConv/lp_solver_unix
LIBS += $$PWD/../MarbleCommon/MinNearConv/lp_solver_win/liblpsolve55.so
}
win32 {
INCLUDEPATH += $$PWD/../MarbleCommon/MinNearConv/lp_solver_win
DEPENDPATH += $$PWD/../MarbleCommon/MinNearConv/lp_solver_win
LIBS += $$PWD/../MarbleCommon/MinNearConv/lp_solver_win/liblpsolve55.a
}