Link errors when implementing MS RDP client in Qt with files generated by dumpcpp tools from mstscax.dll?

0

Recently I was developing an RDP software inside Qt using MS compiler.I did the following steps as this link showed:

  1. Generate mstsclib.h and mstsclib.cpp files from mstscax.dll using Qt dumpcpp tools
  2. Include mstsclib.h and call the ActiveX api as the source code shows

The compile step seemed to work well,but the link failed with many LNK2019 errors.I guess somewhere maybe wrong or I was missing configurations.

I'm not very experienced in c++ so I could not figure it out. Can anyone help me with this confusing problem?So many thanks.

Environment:

  1. Win10 64bit
  2. Qt 5.12.0
  3. CLion 2019.1
  4. Visual Studio 2015 Compiler

Source Code:

#include "rdppage.h"
#include "config.h"
#include "ui_rdppage.h"

#define QAX_DUMPCPP_MSTSCLIB_NOINLINES // Important!
#include "mstsclib.h"

RdpPage::RdpPage(QWidget *parent) :
        QWidget(parent),
        ui(new Ui::RdpPage) {
    ui->setupUi(this);

// used parent widget for embedding ActiveX in it -- this
    auto *rdpWidget = new MSTSCLib::MsRdpClient8NotSafeForScripting(this);

    rdpWidget->show(); // what starts with lower-case is Qt method and uppercase is COM method
    rdpWidget->SetUserName(QString(RDP_USERNAME));
    rdpWidget->SetServer(QString("127.0.0.1"));
    MSTSCLib::IMsRdpClientAdvancedSettings *pAdvSettings = rdpWidget->AdvancedSettings2();
    pAdvSettings->SetClearTextPassword(QString(RDP_PASSWORD));
    rdpWidget->Connect(); // don't forget!
}

Output:

====================[ Build | all | Debug ]=====================================
C:\CommonInstall\cmake-3.12.4-win64-x64\bin\cmake.exe --build D:\ImageProcess\OpenCV\LearnOpenCV\cmake-build-debug --target all --
    C:\CommonInstall\cmake-3.12.4-win64-x64\bin\cmake.exe -HD:\ImageProcess\OpenCV\LearnOpenCV -BD:\ImageProcess\OpenCV\LearnOpenCV\cmake-build-debug --check-build-system CMakeFiles\Makefile.cmake 0
    C:\CommonInstall\cmake-3.12.4-win64-x64\bin\cmake.exe -E cmake_progress_start D:\ImageProcess\OpenCV\LearnOpenCV\cmake-build-debug\CMakeFiles D:\ImageProcess\OpenCV\LearnOpenCV\cmake-build-debug\CMakeFiles\progress.marks
    "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\nmake.exe" -f CMakeFiles\Makefile2 /nologo -L                  all
    "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\nmake.exe" -f CMakeFiles\DsyInspector_autogen.dir\build.make /nologo -L                  CMakeFiles\DsyInspector_autogen.dir\depend
    C:\CommonInstall\cmake-3.12.4-win64-x64\bin\cmake.exe -E cmake_depends "NMake Makefiles" D:\ImageProcess\OpenCV\LearnOpenCV D:\ImageProcess\OpenCV\LearnOpenCV D:\ImageProcess\OpenCV\LearnOpenCV\cmake-build-debug D:\ImageProcess\OpenCV\LearnOpenCV\cmake-build-debug D:\ImageProcess\OpenCV\LearnOpenCV\cmake-build-debug\CMakeFiles\DsyInspector_autogen.dir\DependInfo.cmake --color=
    "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\nmake.exe" -f CMakeFiles\DsyInspector_autogen.dir\build.make /nologo -L                  CMakeFiles\DsyInspector_autogen.dir\build
[  9%] Automatic MOC and UIC for target DsyInspector
    C:\CommonInstall\cmake-3.12.4-win64-x64\bin\cmake.exe -E cmake_autogen D:/ImageProcess/OpenCV/LearnOpenCV/cmake-build-debug/CMakeFiles/DsyInspector_autogen.dir/AutogenInfo.cmake Debug
[  9%] Built target DsyInspector_autogen
    "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\nmake.exe" -f CMakeFiles\DsyInspector.dir\build.make /nologo -L                  CMakeFiles\DsyInspector.dir\depend
[ 18%] Automatic RCC for resources/image_list.qrc
    C:\CommonInstall\cmake-3.12.4-win64-x64\bin\cmake.exe -E cmake_autorcc D:/ImageProcess/OpenCV/LearnOpenCV/cmake-build-debug/CMakeFiles/DsyInspector_autogen.dir/RCCimage_listInfo.cmake Debug
    C:\CommonInstall\cmake-3.12.4-win64-x64\bin\cmake.exe -E cmake_depends "NMake Makefiles" D:\ImageProcess\OpenCV\LearnOpenCV D:\ImageProcess\OpenCV\LearnOpenCV D:\ImageProcess\OpenCV\LearnOpenCV\cmake-build-debug D:\ImageProcess\OpenCV\LearnOpenCV\cmake-build-debug D:\ImageProcess\OpenCV\LearnOpenCV\cmake-build-debug\CMakeFiles\DsyInspector.dir\DependInfo.cmake --color=
Scanning dependencies of target DsyInspector
    "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\nmake.exe" -f CMakeFiles\DsyInspector.dir\build.make /nologo -L                  CMakeFiles\DsyInspector.dir\build
[ 27%] Building CXX object CMakeFiles/DsyInspector.dir/widgets/launcherpage.cpp.obj
    C:\PROGRA~2\MICROS~1.0\VC\bin\amd64\cl.exe @C:\Users\Shinelon\AppData\Local\Temp\nm39CE.tmp
launcherpage.cpp
[ 36%] Building CXX object CMakeFiles/DsyInspector.dir/widgets/mainpage.cpp.obj
    C:\PROGRA~2\MICROS~1.0\VC\bin\amd64\cl.exe @C:\Users\Shinelon\AppData\Local\Temp\nm46DF.tmp
mainpage.cpp
[ 45%] Building CXX object CMakeFiles/DsyInspector.dir/widgets/rdp/rdppage.cpp.obj
    C:\PROGRA~2\MICROS~1.0\VC\bin\amd64\cl.exe @C:\Users\Shinelon\AppData\Local\Temp\nm4F3D.tmp
rdppage.cpp
[ 54%] Building RC object CMakeFiles/DsyInspector.dir/resources/release.rc.res
    C:\PROGRA~2\WI3CF2~1\8.1\bin\x64\rc.exe -DQT_AXBASE_LIB -DQT_AXCONTAINER_LIB -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -ID:\ImageProcess\OpenCV\LearnOpenCV\cmake-build-debug\DsyInspector_autogen\include -ID:\ImageProcess\OpenCV\LearnOpenCV\resources\images -ID:\ImageProcess\OpenCV\LearnOpenCV\cmake-build-debug -IC:\Qt\Qt5.12.0\5.12.0\msvc2017_64\include -IC:\Qt\Qt5.12.0\5.12.0\msvc2017_64\include\QtCore -IC:\Qt\Qt5.12.0\5.12.0\msvc2017_64\.\mkspecs\win32-msvc -IC:\Qt\Qt5.12.0\5.12.0\msvc2017_64\include\QtWidgets -IC:\Qt\Qt5.12.0\5.12.0\msvc2017_64\include\QtGui -IC:\Qt\Qt5.12.0\5.12.0\msvc2017_64\include\QtANGLE -IC:\Qt\Qt5.12.0\5.12.0\msvc2017_64\include\ActiveQt /DWIN32 /D_DEBUG /foCMakeFiles\DsyInspector.dir\resources\release.rc.res D:\ImageProcess\OpenCV\LearnOpenCV\resources\release.rc
Microsoft (R) Windows (R) Resource Compiler Version 6.3.9600.17336
Copyright (C) Microsoft Corporation.  All rights reserved.

[ 63%] Building CXX object CMakeFiles/DsyInspector.dir/application.cpp.obj
    C:\PROGRA~2\MICROS~1.0\VC\bin\amd64\cl.exe @C:\Users\Shinelon\AppData\Local\Temp\nm5A4A.tmp
application.cpp
[ 72%] Building CXX object CMakeFiles/DsyInspector.dir/bin/mstsclib.cpp.obj
    C:\PROGRA~2\MICROS~1.0\VC\bin\amd64\cl.exe @C:\Users\Shinelon\AppData\Local\Temp\nm624A.tmp
mstsclib.cpp
[ 81%] Building CXX object CMakeFiles/DsyInspector.dir/DsyInspector_autogen/mocs_compilation.cpp.obj
    C:\PROGRA~2\MICROS~1.0\VC\bin\amd64\cl.exe @C:\Users\Shinelon\AppData\Local\Temp\nm6BFF.tmp
mocs_compilation.cpp
[ 90%] Building CXX object CMakeFiles/DsyInspector.dir/DsyInspector_autogen/3YJK5W5UP7/qrc_image_list.cpp.obj
    C:\PROGRA~2\MICROS~1.0\VC\bin\amd64\cl.exe @C:\Users\Shinelon\AppData\Local\Temp\nm73C0.tmp
qrc_image_list.cpp
[100%] Linking CXX executable DsyInspector.exe
    C:\CommonInstall\cmake-3.12.4-win64-x64\bin\cmake.exe -E vs_link_exe --intdir=CMakeFiles\DsyInspector.dir --manifests  -- C:\PROGRA~2\MICROS~1.0\VC\bin\amd64\link.exe /nologo @CMakeFiles\DsyInspector.dir\objects1.rsp @C:\Users\Shinelon\AppData\Local\Temp\nm76EE.tmp
LINK Pass 1: command "C:\PROGRA~2\MICROS~1.0\VC\bin\amd64\link.exe /nologo @CMakeFiles\DsyInspector.dir\objects1.rsp /out:DsyInspector.exe /implib:DsyInspector.lib /pdb:D:\ImageProcess\OpenCV\LearnOpenCV\cmake-build-debug\DsyInspector.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console C:\Qt\Qt5.12.0\5.12.0\msvc2017_64\lib\Qt5AxContainerd.lib C:\Qt\Qt5.12.0\5.12.0\msvc2017_64\lib\Qt5AxBased.lib C:\Qt\Qt5.12.0\5.12.0\msvc2017_64\lib\Qt5Widgetsd.lib C:\Qt\Qt5.12.0\5.12.0\msvc2017_64\lib\Qt5Guid.lib C:\Qt\Qt5.12.0\5.12.0\msvc2017_64\lib\Qt5Cored.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\DsyInspector.dir/intermediate.manifest CMakeFiles\DsyInspector.dir/manifest.res" failed (exit code 1120) with the following output:
LINK : DsyInspector.exe not found or not built by the last incremental link; performing full link
Qt5AxContainerd.lib(qaxbase.obj) : warning LNK4099: PDB 'Qt5AxContainerd.pdb' was not found with 'Qt5AxContainerd.lib(qaxbase.obj)' or at 'D:\ImageProcess\OpenCV\LearnOpenCV\cmake-build-debug\Qt5AxContainerd.pdb'; linking object as if no debug info
Qt5AxContainerd.lib(qaxwidget.obj) : warning LNK4099: PDB 'Qt5AxContainerd.pdb' was not found with 'Qt5AxContainerd.lib(qaxwidget.obj)' or at 'D:\ImageProcess\OpenCV\LearnOpenCV\cmake-build-debug\Qt5AxContainerd.pdb'; linking object as if no debug info
Qt5AxContainerd.lib(qaxobject.obj) : warning LNK4099: PDB 'Qt5AxContainerd.pdb' was not found with 'Qt5AxContainerd.lib(qaxobject.obj)' or at 'D:\ImageProcess\OpenCV\LearnOpenCV\cmake-build-debug\Qt5AxContainerd.pdb'; linking object as if no debug info
Qt5AxContainerd.lib(qaxtypes.obj) : warning LNK4099: PDB 'Qt5AxContainerd.pdb' was not found with 'Qt5AxContainerd.lib(qaxtypes.obj)' or at 'D:\ImageProcess\OpenCV\LearnOpenCV\cmake-build-debug\Qt5AxContainerd.pdb'; linking object as if no debug info
Qt5AxContainerd.lib(qaxutils.obj) : warning LNK4099: PDB 'Qt5AxContainerd.pdb' was not found with 'Qt5AxContainerd.lib(qaxutils.obj)' or at 'D:\ImageProcess\OpenCV\LearnOpenCV\cmake-build-debug\Qt5AxContainerd.pdb'; linking object as if no debug info
Qt5AxBased.lib(qaxtypefunctions.obj) : warning LNK4099: PDB 'Qt5AxBased.pdb' was not found with 'Qt5AxBased.lib(qaxtypefunctions.obj)' or at 'D:\ImageProcess\OpenCV\LearnOpenCV\cmake-build-debug\Qt5AxBased.pdb'; linking object as if no debug info
rdppage.cpp.obj : error LNK2019: unresolved external symbol "public: void __cdecl MSTSCLib::IMsRdpClientAdvancedSettings::SetClearTextPassword(class QString const &)" (?SetClearTextPassword@IMsRdpClientAdvancedSettings@MSTSCLib@@QEAAXAEBVQString@@@Z) referenced in function "public: __cdecl RdpPage::RdpPage(class QWidget *)" (??0RdpPage@@QEAA@PEAVQWidget@@@Z)
rdppage.cpp.obj : error LNK2019: unresolved external symbol "public: class MSTSCLib::IMsRdpClientAdvancedSettings * __cdecl MSTSCLib::MsRdpClient8NotSafeForScripting::AdvancedSettings2(void)const " (?AdvancedSettings2@MsRdpClient8NotSafeForScripting@MSTSCLib@@QEBAPEAVIMsRdpClientAdvancedSettings@2@XZ) referenced in function "public: __cdecl RdpPage::RdpPage(class QWidget *)" (??0RdpPage@@QEAA@PEAVQWidget@@@Z)
rdppage.cpp.obj : error LNK2019: unresolved external symbol "public: void __cdecl MSTSCLib::MsRdpClient8NotSafeForScripting::SetServer(class QString const &)" (?SetServer@MsRdpClient8NotSafeForScripting@MSTSCLib@@QEAAXAEBVQString@@@Z) referenced in function "public: __cdecl RdpPage::RdpPage(class QWidget *)" (??0RdpPage@@QEAA@PEAVQWidget@@@Z)
rdppage.cpp.obj : error LNK2019: unresolved external symbol "public: void __cdecl MSTSCLib::MsRdpClient8NotSafeForScripting::SetUserName(class QString const &)" (?SetUserName@MsRdpClient8NotSafeForScripting@MSTSCLib@@QEAAXAEBVQString@@@Z) referenced in function "public: __cdecl RdpPage::RdpPage(class QWidget *)" (??0RdpPage@@QEAA@PEAVQWidget@@@Z)
rdppage.cpp.obj : error LNK2019: unresolved external symbol "public: void __cdecl MSTSCLib::MsRdpClient8NotSafeForScripting::Connect(void)" (?Connect@MsRdpClient8NotSafeForScripting@MSTSCLib@@QEAAXXZ) referenced in function "public: __cdecl RdpPage::RdpPage(class QWidget *)" (??0RdpPage@@QEAA@PEAVQWidget@@@Z)
DsyInspector.exe : fatal error LNK1120: 5 unresolved externals
NMAKE : fatal error U1077: 'C:\CommonInstall\cmake-3.12.4-win64-x64\bin\cmake.exe' : return code '0xffffffff'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\nmake.exe"' : return code '0x2'
Stop.

c++
qt
clion
rdp
asked on Stack Overflow May 12, 2019 by Vincyan • edited May 12, 2019 by Vincyan

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0