【问题标题】:Pantheios in Qt creator with VS C++ 2008 compiler带有 VS C++ 2008 编译器的 Qt 创建器中的 Pantheios
【发布时间】:2012-09-13 12:16:55
【问题描述】:

我无法编译在 Qt Creator 中使用 Pantheios(版本 1.0.1-beta210)记录器的项目(已编译创建者 2.5.2 + SDK 4.8.2来自带有 VS2008 编译器的源代码)和 VS2008 C++ 编译器。 但它适用于 Visual Studio 2008!

  1. 首先,我编译了 Pantheios 库,因为它应该使用 VS 命令行和路径为 pantheios_path\build\vc9\的 nmake

  2. 然后我用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();
    }
    
  3. 但是当我将它导出到 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
    ...
    
  4. 我还尝试通过以下方式更改 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...

【问题讨论】:

    标签: c++ qt visual-studio-2008 qt-creator pantheios


    【解决方案1】:

    请在 MSDN 中搜索函数,然后您可以找到您错过的库。例如符号“_imp_RegCloseKey@4”,请在MSDN中搜索“RegCloseKey”,你会发现你漏掉了“Advapi32.lib”。然后你应该把这个库添加到你的@ 987654321@文件。

    LIBS += -lAdvapi32
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-08-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多