c++qtvisual-studio-2008qt-creatorpantheios

Pantheios in Qt creator with VS C++ 2008 compiler


I can't compile my project that uses Pantheios (version 1.0.1-beta210) logger in Qt Creator (creator 2.5.2 + SDK 4.8.2 compiled from sources with VS2008 compiler) with VS2008 C++ compiler. But it works with Visual Studio 2008!

  1. First, I've compiled Pantheios library as it should be using VS command line and nmake with path pantheios_path\build\vc9\

  2. Then I have written a simple Qt program using VS2008 with Qt Addin and it works fine:

    #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. But when I export it to Qt Creator project it doesn't want to link with errors:

    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
    

    By the way, in project.pro file I set:

    ...
        INCLUDEPATH += $(STLSOFT)/include \
                   $(PANTHEIOS_ROOT)/include
    
        LIBS += -L$(PANTHEIOS_ROOT)/lib
    ...
    
  4. Also I have tryed to change LIBS variable following way:

    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
    

    And get this:

    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
    

I also tried different combinations of :

LIBS += -L$(PANTHEIOS_ROOT)/lib -llibname_without_extension

Can anyone give me a helpful advice? Maybe someone use Pantheios under Qt Creator...


Solution

  • Please search the functions in MSDN, then you can get what libraries you missed. For example, to the symbol "_imp_RegCloseKey@4”, please search “RegCloseKey” in MSDN, you can find that you missed “Advapi32.lib”. Then you shall add this library in your .pro file.

    LIBS += -lAdvapi32