我无法使用VS2008 C++ 编译器在Qt Creator(使用 VS2008 编译器从源代码编译的创建者 2.5.2 + SDK 4.8.2 )中使用Pantheios(版本 1.0.1-beta210)记录器编译我的项目。但它适用于 Visual Studio 2008!
首先,我编译了 Pantheios 库,因为它应该使用 VS 命令行和带有路径的 nmake
pantheios_path\build\vc9\
然后我用VS2008和Qt Addin编写了一个简单的Qt程序,它工作正常:
#include <pantheios/pantheios.hpp> #include <pantheios/inserters/args.hpp> #include <pantheios/backends/bec.WindowsConsole.h> #include <pantheios/implicit_link/core.h> #include <pantheios/implicit_link/fe.simple.h> #include <pantheios/implicit_link/be.WindowsConsole.h> #include <QApplication> #include "MainWindow.h" extern "C" const char PANTHEIOS_FE_PROCESS_IDENTITY[] = PANTHEIOS_LITERAL_STRING("play.with.logger"); int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); pantheios::log(pantheios::debug, "debug processing condition"); return a.exec(); }
但是当我将它导出到 Qt Creator 项目时,它不想与错误链接:
pantheios.1.util.vc9.dll.debug.lib(util.bailout.dll.debug.obj) : error LNK2019: unresolved external symbol __imp__RegCloseKey@4 referenced in function _pantheios_util_onBailOut_canUseWarnMessage_x_ pantheios.1.util.vc9.dll.debug.lib(util.time.dll.debug.obj) : error LNK2001: unresolved external symbol __imp__RegCloseKey@4 pantheios.1.util.vc9.dll.debug.lib(util.bailout.dll.debug.obj) : error LNK2019: unresolved external symbol __imp__RegQueryValueExA@24 referenced in function _pantheios_util_onBailOut_canUseWarnMessage_x_ pantheios.1.util.vc9.dll.debug.lib(util.time.dll.debug.obj) : error LNK2001: unresolved external symbol __imp__RegQueryValueExA@24 pantheios.1.util.vc9.dll.debug.lib(util.bailout.dll.debug.obj) : error LNK2019: unresolved external symbol __imp__RegOpenKeyA@12 referenced in function _pantheios_util_onBailOut_canUseWarnMessage_x_ pantheios.1.util.vc9.dll.debug.lib(util.time.dll.debug.obj) : error LNK2001: unresolved external symbol __imp__RegOpenKeyA@12 pantheios.1.util.vc9.dll.debug.lib(util.bailout.dll.debug.obj) : error LNK2019: unresolved external symbol __imp__DeregisterEventSource@4 referenced in function _pantheios_onBailOut3 pantheios.1.util.vc9.dll.debug.lib(util.bailout.dll.debug.obj) : error LNK2019: unresolved external symbol __imp__ReportEventA@36 referenced in function _pantheios_onBailOut3 pantheios.1.util.vc9.dll.debug.lib(util.bailout.dll.debug.obj) : error LNK2019: unresolved external symbol __imp__RegisterEventSourceA@8 referenced in function _pantheios_onBailOut3 debug\Logging3.exe : fatal error LNK1120: 6 unresolved externals
顺便说一句,在
project.pro
我设置的文件中:... INCLUDEPATH += $(STLSOFT)/include \ $(PANTHEIOS_ROOT)/include LIBS += -L$(PANTHEIOS_ROOT)/lib ...
我也尝试通过以下方式更改 LIBS 变量:
LIBS += d:\workspaces\VS\pantheios-1.0.1-beta210_32\lib\pantheios.1.util.vc9.dll.debug.lib \ d:\workspaces\VS\pantheios-1.0.1-beta210_32\lib\pantheios.1.core.vc9.dll.debug.lib \ d:\workspaces\VS\pantheios-1.0.1-beta210_32\lib\pantheios.1.fe.simple.vc9.dll.debug.lib \ d:\workspaces\VS\pantheios-1.0.1-beta210_32\lib\pantheios.1.bec.WindowsConsole.vc9.dll.debug.lib \ d:\workspaces\VS\pantheios-1.0.1-beta210_32\lib\pantheios.1.be.WindowsConsole.vc9.dll.debug.lib
得到这个:
pantheios.1.util.vc9.dll.debug.lib(util.bailout.dll.debug.obj) : error LNK2019: unresolved external symbol __imp__RegCloseKey@4 referenced in function _pantheios_util_onBailOut_canUseWarnMessage_x_ pantheios.1.util.vc9.dll.debug.lib(util.time.dll.debug.obj) : error LNK2001: unresolved external symbol __imp__RegCloseKey@4 pantheios.1.util.vc9.dll.debug.lib(util.bailout.dll.debug.obj) : error LNK2019: unresolved external symbol __imp__RegQueryValueExA@24 referenced in function _pantheios_util_onBailOut_canUseWarnMessage_x_ pantheios.1.util.vc9.dll.debug.lib(util.time.dll.debug.obj) : error LNK2001: unresolved external symbol __imp__RegQueryValueExA@24 pantheios.1.util.vc9.dll.debug.lib(util.bailout.dll.debug.obj) : error LNK2019: unresolved external symbol __imp__RegOpenKeyA@12 referenced in function _pantheios_util_onBailOut_canUseWarnMessage_x_ pantheios.1.util.vc9.dll.debug.lib(util.time.dll.debug.obj) : error LNK2001: unresolved external symbol __imp__RegOpenKeyA@12 pantheios.1.util.vc9.dll.debug.lib(util.bailout.dll.debug.obj) : error LNK2019: unresolved external symbol __imp__DeregisterEventSource@4 referenced in function _pantheios_onBailOut3 pantheios.1.util.vc9.dll.debug.lib(util.bailout.dll.debug.obj) : error LNK2019: unresolved external symbol __imp__ReportEventA@36 referenced in function _pantheios_onBailOut3 pantheios.1.util.vc9.dll.debug.lib(util.bailout.dll.debug.obj) : error LNK2019: unresolved external symbol __imp__RegisterEventSourceA@8 referenced in function _pantheios_onBailOut3 debug\Logging3.exe : fatal error LNK1120: 6 unresolved externals
我还尝试了不同的组合:
LIBS += -L$(PANTHEIOS_ROOT)/lib -llibname_without_extension
谁能给我一个有用的建议?也许有人在 Qt Creator 下使用 Pantheios ......