Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Shared library on windows fails when using moc

Shared library on windows fails when using moc

Scheduled Pinned Locked Moved Solved General and Desktop
41 Posts 4 Posters 10.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Mesrine
    30 May 2023, 19:33

    @Christian-Ehrlicher
    Where should i put this on qpow.cpp?

    C Offline
    C Offline
    Christian Ehrlicher
    Lifetime Qt Champion
    wrote on 30 May 2023, 19:37 last edited by
    #31

    @Mesrine doesn't matter - includes should go to the top.

    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
    Visit the Qt Academy at https://academy.qt.io/catalog

    1 Reply Last reply
    0
    • M Mesrine
      30 May 2023, 19:27

      @SGaist

      I tried on the shared library

      #include <QtCore/QtGlobal>
      
      #if defined(MYSHAREDLIB_LIBRARY)
      # define MYSHAREDLIB_EXPORT Q_DECL_EXPORT
      #else
      #define MYSHAREDLIB_EXPORT Q_DECL_IMPORT
      #endif
      namespace qiota{
      
      	namespace qpow {
      
      
      		class MYSHAREDLIB_EXPORT nonceFinder : public QObject
      		{
      			Q_OBJECT
      			public:
      

      in the cmakelist.txt of the shared library

      add_library(qpow include/pow/qpow.hpp qpow.cpp)
      target_compile_definitions(qpow PRIVATE MYSHAREDLIB_LIBRARY)
      

      As you can see on this commit
      This compiles the library in windows, linux, macos shared and static as before.

      I did the same for the client library as you can see for the
      comparison of the branch

      but this again fails for windows shared library as you can see form the workflow run with error

        cmake --build .
        shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
        env:
          CommandPromptType: Native
          DevEnvDir: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\
          ExtensionSdkDir: C:\Program Files (x86)\Microsoft SDKs\Windows Kits\10\ExtensionSDKs
          EXTERNAL_INCLUDE: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\include;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\ATLMFC\include;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\VS\include;C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt;C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um;C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared;C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt;C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um
          Framework40Version: v4.0
          FrameworkDir: C:\Windows\Microsoft.NET\Framework64\
          FrameworkDir64: C:\Windows\Microsoft.NET\Framework64\
          FrameworkVersion: v4.0.30319
          FrameworkVersion64: v4.0.30319
          FSHARPINSTALLDIR: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\FSharp\Tools
          HTMLHelpDir: C:\Program Files (x86)\HTML Help Workshop
          INCLUDE: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\include;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\ATLMFC\include;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\VS\include;C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt;C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um;C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared;C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt;C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um
          is_x64_arch: true
          LIB: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\ATLMFC\lib\x64;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\lib\x64;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.22621.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\\lib\10.0.22621.0\\um\x64
          LIBPATH: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\ATLMFC\lib\x64;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\lib\x64;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\lib\x86\store\references;C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.22621.0;C:\Program Files (x86)\Windows Kits\10\References\10.0.22621.0;C:\Windows\Microsoft.NET\Framework64\v4.0.30319
          NETFXSDKDir: C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\
          Path: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\bin\HostX64\x64;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\VC\VCPackages;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\bin\Roslyn;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Team Tools\Performance Tools\x64;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Team Tools\Performance Tools;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\;C:\Program Files (x86)\HTML Help Workshop;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\FSharp\Tools;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\Extensions\Microsoft\CodeCoverage.Console;C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\\x64;C:\Program Files (x86)\Windows Kits\10\bin\\x64;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\\MSBuild\Current\Bin\amd64;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\;C:\Program Files\MongoDB\Server\5.0\bin;C:\aliyun-cli;C:\vcpkg;C:\Program Files (x86)\NSIS\;C:\tools\zstd;C:\Program Files\Mercurial\;C:\hostedtoolcache\windows\stack\2.9.3\x64;C:\cabal\bin;C:\\ghcup\bin;C:\Program Files\dotnet;C:\mysql\bin;C:\Program Files\R\R-4.3.0\bin\x64;C:\SeleniumWebDrivers\GeckoDriver;C:\Program Files (x86)\sbt\bin;C:\Program Files (x86)\GitHub CLI;C:\Program Files\Git\bin;C:\Program Files (x86)\pipx_bin;C:\npm\prefix;C:\hostedtoolcache\windows\go\1.20.4\x64\bin;C:\hostedtoolcache\windows\Python\3.9.13\x64\Scripts;C:\hostedtoolcache\windows\Python\3.9.13\x64;C:\hostedtoolcache\windows\Ruby\3.0.6\x64\bin;C:\Program Files\OpenSSL\bin;C:\tools\kotlinc\bin;C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\8.0.372-7\x64\bin;C:\Program Files\ImageMagick-7.1.1-Q16-HDRI;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\ProgramData\kind;C:\Program Files\Microsoft\jdk-11.0.16.101-hotspot\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\ProgramData\Chocolatey\bin;C:\Program Files\PowerShell\7\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\ProgramData\chocolatey\lib\pulumi\tools\Pulumi\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\CMake\bin;C:\ProgramData\chocolatey\lib\maven\apache-maven-3.8.7\bin;C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code;C:\Program Files\Microsoft SDKs\Service Fabric\Tools\ServiceFabricLocalClusterManager;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\GitHub CLI\;c:\tools\php;C:\SeleniumWebDrivers\ChromeDriver\;C:\SeleniumWebDrivers\EdgeDriver\;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Amazon\SessionManagerPlugin\bin\;C:\Program Files\Amazon\AWSSAMCLI\bin\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\LLVM\bin;C:\Users\runneradmin\.dotnet\tools;C:\Users\runneradmin\.cargo\bin;C:\Users\runneradmin\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Microsoft Visual Studio\Installer;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\Llvm\x64\bin;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\VC\Linux\bin\ConnectionManagerExe
          Platform: x64
          UCRTVersion: 10.0.22621.0
          UniversalCRTSdkDir: C:\Program Files (x86)\Windows Kits\10\
          VCIDEInstallDir: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\VC\
          VCINSTALLDIR: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\
          VCToolsInstallDir: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.34.31933\
          VCToolsRedistDir: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\14.34.31931\
          VCToolsVersion: 14.34.31933
          VisualStudioVersion: 17.0
          VS170COMNTOOLS: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\
          VSCMD_ARG_app_plat: Desktop
          VSCMD_ARG_HOST_ARCH: x64
          VSCMD_ARG_TGT_ARCH: x64
          VSCMD_VER: 17.5.5
          VSINSTALLDIR: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\
          VSSDK150INSTALL: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VSSDK
          VSSDKINSTALL: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VSSDK
          WindowsLibPath: C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.22621.0;C:\Program Files (x86)\Windows Kits\10\References\10.0.22621.0
          WindowsSdkBinPath: C:\Program Files (x86)\Windows Kits\10\bin\
          WindowsSdkDir: C:\Program Files (x86)\Windows Kits\10\
          WindowsSDKLibVersion: 10.0.22621.0\
          WindowsSdkVerBinPath: C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\
          WindowsSDKVersion: 10.0.22621.0\
          WindowsSDK_ExecutablePath_x64: C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\
          WindowsSDK_ExecutablePath_x86: C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\
          __DOTNET_ADD_64BIT: 1
          __DOTNET_PREFERRED_BITNESS: 64
          __VSCMD_PREINIT_PATH: C:\Program Files\MongoDB\Server\5.0\bin;C:\aliyun-cli;C:\vcpkg;C:\Program Files (x86)\NSIS\;C:\tools\zstd;C:\Program Files\Mercurial\;C:\hostedtoolcache\windows\stack\2.9.3\x64;C:\cabal\bin;C:\\ghcup\bin;C:\Program Files\dotnet;C:\mysql\bin;C:\Program Files\R\R-4.3.0\bin\x64;C:\SeleniumWebDrivers\GeckoDriver;C:\Program Files (x86)\sbt\bin;C:\Program Files (x86)\GitHub CLI;C:\Program Files\Git\bin;C:\Program Files (x86)\pipx_bin;C:\npm\prefix;C:\hostedtoolcache\windows\go\1.20.4\x64\bin;C:\hostedtoolcache\windows\Python\3.9.13\x64\Scripts;C:\hostedtoolcache\windows\Python\3.9.13\x64;C:\hostedtoolcache\windows\Ruby\3.0.6\x64\bin;C:\Program Files\OpenSSL\bin;C:\tools\kotlinc\bin;C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\8.0.372-7\x64\bin;C:\Program Files\ImageMagick-7.1.1-Q16-HDRI;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\ProgramData\kind;C:\Program Files\Microsoft\jdk-11.0.16.101-hotspot\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\ProgramData\Chocolatey\bin;C:\Program Files\PowerShell\7\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Strawberry\c\bin;C:\Strawberry\perl\site\bin;C:\Strawberry\perl\bin;C:\ProgramData\chocolatey\lib\pulumi\tools\Pulumi\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\CMake\bin;C:\ProgramData\chocolatey\lib\maven\apache-maven-3.8.7\bin;C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code;C:\Program Files\Microsoft SDKs\Service Fabric\Tools\ServiceFabricLocalClusterManager;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\GitHub CLI\;c:\tools\php;C:\Program Files (x86)\sbt\bin;C:\SeleniumWebDrivers\ChromeDriver\;C:\SeleniumWebDrivers\EdgeDriver\;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\Amazon\SessionManagerPlugin\bin\;C:\Program Files\Amazon\AWSSAMCLI\bin\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\LLVM\bin;C:\Users\runneradmin\.dotnet\tools;C:\Users\runneradmin\.cargo\bin;C:\Users\runneradmin\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Microsoft Visual Studio\Installer
          pythonLocation: C:\hostedtoolcache\windows\Python\3.11.3\x64
      [42/101] Building CXX object _deps\qed25519-build\CMakeFiles\qed25519.dir\qed25519.cpp.obj
      [43/101] Linking CXX shared library qbech32.dll
      [44/101] Building C object _deps\qed25519-build\CMakeFiles\qed25519.dir\src\add_scalar.c.obj
      [45/101] Linking CXX shared library qpow.dll
      [46/101] Building C object _deps\qed25519-build\CMakeFiles\qed25519.dir\src\fe.c.obj
      [47/101] Building C object _deps\qed25519-build\CMakeFiles\qed25519.dir\src\ge.c.obj
      [48/101] Building C object _deps\qed25519-build\CMakeFiles\qed25519.dir\src\key_exchange.c.obj
      [49/101] Building C object _deps\qed25519-build\CMakeFiles\qed25519.dir\src\keypair.c.obj
      [50/101] Automatic MOC and UIC for target qclient
      [51/101] Building C object _deps\qed25519-build\CMakeFiles\qed25519.dir\src\sc.c.obj
      [52/101] Building CXX object CMakeFiles\qclient.dir\qclient_autogen\mocs_compilation.cpp.obj
      [53/101] Building CXX object CMakeFiles\qclient.dir\qclient.cpp.obj
      [54/101] Building CXX object CMakeFiles\qclient.dir\src\qnode_response.cpp.obj
      [55/101] Building CXX object CMakeFiles\qclient.dir\src\qnode_info.cpp.obj
      [56/101] Building CXX object CMakeFiles\qclient.dir\src\qnode_tips.cpp.obj
      [57/101] Building CXX object CMakeFiles\qclient.dir\src\qnode_blockId.cpp.obj
      [58/101] Building CXX object CMakeFiles\qclient.dir\src\qnode_block.cpp.obj
      [59/101] Building CXX object CMakeFiles\qclient.dir\src\qnode_outputs.cpp.obj
      [60/101] Building C object _deps\qed25519-build\CMakeFiles\qed25519.dir\src\sha512.c.obj
      [61/101] Building C object _deps\qed25519-build\CMakeFiles\qed25519.dir\src\sign.c.obj
      [62/101] Building C object _deps\qed25519-build\CMakeFiles\qed25519.dir\src\verify.c.obj
      [63/101] Automatic MOC and UIC for target qslip10
      [64/101] Building CXX object _deps\qslip10-build\CMakeFiles\qslip10.dir\qslip10_autogen\mocs_compilation.cpp.obj
      [65/101] Linking CXX shared library qclient.dll
      FAILED: qclient.dll qclient.lib 
      cmd.exe /C "cmd.exe /C ""C:\Program Files\CMake\bin\cmake.exe" -E __create_def D:\a\_temp\build\CMakeFiles\qclient.dir\.\exports.def D:\a\_temp\build\CMakeFiles\qclient.dir\.\exports.def.objs && cd D:\a\_temp\build" && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_dll --intdir=CMakeFiles\qclient.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MICROS~2\2022\ENTERP~1\VC\Tools\MSVC\1434~1.319\bin\HostX64\x64\link.exe /nologo CMakeFiles\qclient.dir\qclient_autogen\mocs_compilation.cpp.obj CMakeFiles\qclient.dir\qclient.cpp.obj CMakeFiles\qclient.dir\src\qnode_response.cpp.obj CMakeFiles\qclient.dir\src\qnode_info.cpp.obj CMakeFiles\qclient.dir\src\qnode_tips.cpp.obj CMakeFiles\qclient.dir\src\qnode_blockId.cpp.obj CMakeFiles\qclient.dir\src\qnode_block.cpp.obj CMakeFiles\qclient.dir\src\qnode_outputs.cpp.obj  /out:qclient.dll /implib:qclient.lib /pdb:qclient.pdb /dll /version:0.0 /machine:x64 /INCREMENTAL:NO  /DEF:CMakeFiles\qclient.dir\.\exports.def  D:\a\Qclient-IOTA\Qt\6.5.0\msvc2019_64\lib\Qt6Network.lib  _deps\qblock-build\qblock.lib  _deps\qpow-build\qpow.lib  ws2_32.lib  _deps\qbigint-build\qbigint.lib  D:\a\Qclient-IOTA\Qt\6.5.0\msvc2019_64\lib\Qt6Core.lib  mpr.lib  userenv.lib  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib  && cd ."
      LINK: command "C:\PROGRA~1\MICROS~2\2022\ENTERP~1\VC\Tools\MSVC\1434~1.319\bin\HostX64\x64\link.exe /nologo CMakeFiles\qclient.dir\qclient_autogen\mocs_compilation.cpp.obj CMakeFiles\qclient.dir\qclient.cpp.obj CMakeFiles\qclient.dir\src\qnode_response.cpp.obj CMakeFiles\qclient.dir\src\qnode_info.cpp.obj CMakeFiles\qclient.dir\src\qnode_tips.cpp.obj CMakeFiles\qclient.dir\src\qnode_blockId.cpp.obj CMakeFiles\qclient.dir\src\qnode_block.cpp.obj CMakeFiles\qclient.dir\src\qnode_outputs.cpp.obj /out:qclient.dll /implib:qclient.lib /pdb:qclient.pdb /dll /version:0.0 /machine:x64 /INCREMENTAL:NO /DEF:CMakeFiles\qclient.dir\.\exports.def D:\a\Qclient-IOTA\Qt\6.5.0\msvc2019_64\lib\Qt6Network.lib _deps\qblock-build\qblock.lib _deps\qpow-build\qpow.lib ws2_32.lib _deps\qbigint-build\qbigint.lib D:\a\Qclient-IOTA\Qt\6.5.0\msvc2019_64\lib\Qt6Core.lib mpr.lib userenv.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:qclient.dll.manifest" failed (exit code 1120) with the following output:
         Creating library qclient.lib and object qclient.exp
      qclient.cpp.obj : error LNK2019: unresolved external symbol "public: static struct QMetaObject const qiota::qpow::nonceFinder::staticMetaObject" (?staticMetaObject@nonceFinder@qpow@qiota@@2UQMetaObject@@B) referenced in function "public: static class QMetaObject::Connection __cdecl QObject::connect<void (__cdecl qiota::qpow::nonceFinder::*)(void),class `public: __cdecl `public: __cdecl `public: void __cdecl qiota::Client::send_block(class qiota::qblocks::Block const &)'::`2'::<lambda_2>::operator()(void)const '::`2'::<lambda_1>::operator()(void)const '::`5'::<lambda_2> >(class qiota::qpow::nonceFinder const *,void (__cdecl qiota::qpow::nonceFinder::*)(void),class QObject const *,class `public: __cdecl `public: __cdecl `public: void __cdecl qiota::Client::send_block(class qiota::qblocks::Block const &)'::`2'::<lambda_2>::operator()(void)const '::`2'::<lambda_1>::operator()(void)const '::`5'::<lambda_2>,enum Qt::ConnectionType)" (??$connect@P8nonceFinder@qpow@qiota@@EAAXXZV<lambda_2>@?4???R<lambda_1>@?1???R4?1??send_block@Client@3@QEAAXAEBVBlock@qblocks@3@@Z@QEBA@XZ@QEBA@XZ@@QObject@@SA?AVConnection@QMetaObject@@PEBVnonceFinder@qpow@qiota@@P8345@EAAXXZPEBV0@V<lambda_2>@?4???R<lambda_1>@?1???R6?1??send_block@Client@5@QEAAXAEBVBlock@qblocks@5@@Z@QEBA@XZ@QEBA@XZ@W4ConnectionType@Qt@@@Z)
      
      qclient.dll : fatal error LNK1120: 1 unresolved externals
      
      [66/101] Building CXX object _deps\qslip10-build\CMakeFiles\qslip10.dir\qslip10.cpp.obj
      [67/101] Building C object _deps\qed25519-build\CMakeFiles\qed25519.dir\src\seed.c.obj
      ninja: build stopped: subcommand failed.
      Error: Process completed with exit code 1.
      

      I believe is the same error than before.

      M Offline
      M Offline
      Mesrine
      wrote on 7 Jun 2023, 10:26 last edited by Mesrine 6 Jul 2023, 10:42
      #32

      @Mesrine

      I have checked the moc produced source in windows
      The file is inside build/qpow_autogen/652RYH7CFW/moc_qpow.cpp and the symbol the linker is complaining is defined like this:

      Q_CONSTINIT const QMetaObject qiota::qpow::nonceFinder::staticMetaObject = { {
          QMetaObject::SuperData::link<QObject::staticMetaObject>(),
          qt_meta_stringdata_CLASSqiotaSCOPEqpowSCOPEnonceFinderENDCLASS.offsetsAndSizes,
          qt_meta_data_CLASSqiotaSCOPEqpowSCOPEnonceFinderENDCLASS,
          qt_static_metacall,
          nullptr,
          qt_incomplete_metaTypeArray<qt_meta_stringdata_CLASSqiotaSCOPEqpowSCOPEnonceFinderENDCLASS_t,
              // Q_OBJECT / Q_GADGET
              QtPrivate::TypeAndForceComplete<nonceFinder, std::true_type>,
              // method 'nonce_found'
              QtPrivate::TypeAndForceComplete<void, std::false_type>,
              QtPrivate::TypeAndForceComplete<quint64, std::false_type>,
              // method 'nonce_not_found'
              QtPrivate::TypeAndForceComplete<void, std::false_type>
          >,
          nullptr
      } };
      

      Due to the fact that the linker only complains when building shared library on windows and i have also tried

      #include "qpow.moc"
      

      on the class source giving me the same error.
      Could it be that moc is not exporting the symbol for windows(like using Q_DECL_EXPORT and Q_DECL_IMPORT in the definition) ?

      M 1 Reply Last reply 7 Jun 2023, 10:57
      0
      • M Mesrine
        7 Jun 2023, 10:26

        @Mesrine

        I have checked the moc produced source in windows
        The file is inside build/qpow_autogen/652RYH7CFW/moc_qpow.cpp and the symbol the linker is complaining is defined like this:

        Q_CONSTINIT const QMetaObject qiota::qpow::nonceFinder::staticMetaObject = { {
            QMetaObject::SuperData::link<QObject::staticMetaObject>(),
            qt_meta_stringdata_CLASSqiotaSCOPEqpowSCOPEnonceFinderENDCLASS.offsetsAndSizes,
            qt_meta_data_CLASSqiotaSCOPEqpowSCOPEnonceFinderENDCLASS,
            qt_static_metacall,
            nullptr,
            qt_incomplete_metaTypeArray<qt_meta_stringdata_CLASSqiotaSCOPEqpowSCOPEnonceFinderENDCLASS_t,
                // Q_OBJECT / Q_GADGET
                QtPrivate::TypeAndForceComplete<nonceFinder, std::true_type>,
                // method 'nonce_found'
                QtPrivate::TypeAndForceComplete<void, std::false_type>,
                QtPrivate::TypeAndForceComplete<quint64, std::false_type>,
                // method 'nonce_not_found'
                QtPrivate::TypeAndForceComplete<void, std::false_type>
            >,
            nullptr
        } };
        

        Due to the fact that the linker only complains when building shared library on windows and i have also tried

        #include "qpow.moc"
        

        on the class source giving me the same error.
        Could it be that moc is not exporting the symbol for windows(like using Q_DECL_EXPORT and Q_DECL_IMPORT in the definition) ?

        M Offline
        M Offline
        Mesrine
        wrote on 7 Jun 2023, 10:57 last edited by Mesrine 6 Jul 2023, 10:58
        #33

        @Mesrine
        So the QObject macro will expand in my class and declare the missing symbol on my class header file like

        public: static struct QMetaObject const qiota::qpow::WorkerThread::staticMetaObject.
        

        This symbol is then defined in the moc generated sources that can be included on the class source file or the resulting .obj can be linked to the library.

        But the thing is that the expansion of QObject in my class maybe do not put

        public: 
        Q_DECL_EXPORT(Q_DECL_IMPORT) static struct QMetaObject const qiota::qpow::WorkerThread::staticMetaObject.
        

        So the symbol is not correctly (exported)imported for windows shared.
        Is this reasoning correct?

        M 1 Reply Last reply 7 Jun 2023, 12:52
        0
        • M Mesrine
          7 Jun 2023, 10:57

          @Mesrine
          So the QObject macro will expand in my class and declare the missing symbol on my class header file like

          public: static struct QMetaObject const qiota::qpow::WorkerThread::staticMetaObject.
          

          This symbol is then defined in the moc generated sources that can be included on the class source file or the resulting .obj can be linked to the library.

          But the thing is that the expansion of QObject in my class maybe do not put

          public: 
          Q_DECL_EXPORT(Q_DECL_IMPORT) static struct QMetaObject const qiota::qpow::WorkerThread::staticMetaObject.
          

          So the symbol is not correctly (exported)imported for windows shared.
          Is this reasoning correct?

          M Offline
          M Offline
          Mesrine
          wrote on 7 Jun 2023, 12:52 last edited by
          #34

          @Mesrine
          You can see a much simpler reproducible example of the issue here

          C 1 Reply Last reply 7 Jun 2023, 16:18
          0
          • M Mesrine
            7 Jun 2023, 12:52

            @Mesrine
            You can see a much simpler reproducible example of the issue here

            C Offline
            C Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on 7 Jun 2023, 16:18 last edited by
            #35

            And even there I don't see where you include "moc_foo.cpp" for AUTOMOC or do the moc by yourself anywhere.

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            M 2 Replies Last reply 7 Jun 2023, 18:40
            0
            • C Christian Ehrlicher
              7 Jun 2023, 16:18

              And even there I don't see where you include "moc_foo.cpp" for AUTOMOC or do the moc by yourself anywhere.

              M Offline
              M Offline
              Mesrine
              wrote on 7 Jun 2023, 18:40 last edited by Mesrine 6 Jul 2023, 18:41
              #36

              @Christian-Ehrlicher
              According to qt I do not need to include the header moc files when using cmake.
              I will try and let you know.

              M 1 Reply Last reply 7 Jun 2023, 18:52
              0
              • M Mesrine
                7 Jun 2023, 18:40

                @Christian-Ehrlicher
                According to qt I do not need to include the header moc files when using cmake.
                I will try and let you know.

                M Offline
                M Offline
                Mesrine
                wrote on 7 Jun 2023, 18:52 last edited by Mesrine 6 Jul 2023, 18:52
                #37

                @Mesrine
                As maybe you can see the build fail with the same error.
                But you can check now that the files are included.

                1 Reply Last reply
                0
                • C Christian Ehrlicher
                  7 Jun 2023, 16:18

                  And even there I don't see where you include "moc_foo.cpp" for AUTOMOC or do the moc by yourself anywhere.

                  M Offline
                  M Offline
                  Mesrine
                  wrote on 7 Jun 2023, 18:56 last edited by
                  #38

                  @Christian-Ehrlicher
                  The Automoc is done automatically
                  as i have added in CMakeLists.txt

                  qt_standard_project_setup()
                  

                  that this set AUTOMOC variable ON.

                  C JoeCFDJ 2 Replies Last reply 7 Jun 2023, 18:59
                  0
                  • M Mesrine
                    7 Jun 2023, 18:56

                    @Christian-Ehrlicher
                    The Automoc is done automatically
                    as i have added in CMakeLists.txt

                    qt_standard_project_setup()
                    

                    that this set AUTOMOC variable ON.

                    C Offline
                    C Offline
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on 7 Jun 2023, 18:59 last edited by
                    #39

                    I did not see (and not use by myself) qt_standard_project_setup() so you're correct with the automoc.

                    You use the same define for the export definition for both libraries - how should this work?

                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                    Visit the Qt Academy at https://academy.qt.io/catalog

                    M 1 Reply Last reply 7 Jun 2023, 19:06
                    1
                    • M Mesrine
                      7 Jun 2023, 18:56

                      @Christian-Ehrlicher
                      The Automoc is done automatically
                      as i have added in CMakeLists.txt

                      qt_standard_project_setup()
                      

                      that this set AUTOMOC variable ON.

                      JoeCFDJ Offline
                      JoeCFDJ Offline
                      JoeCFD
                      wrote on 7 Jun 2023, 19:02 last edited by JoeCFD 6 Jul 2023, 19:03
                      #40

                      @Mesrine

                      your libA uses libB. libA imports libB. So do not define WINDOWS_SHAREDLIB in libA
                      target_compile_definitions(libA PRIVATE WINDOWS_SHAREDLIB) <= can not have this one?

                      #if defined(WINDOWS_SHAREDLIB)
                      # define SHAREDLIB_EXPORT Q_DECL_EXPORT
                      #else
                      #define SHAREDLIB_EXPORT Q_DECL_IMPORT  <===libA needs this one if WINDOWS_SHAREDLIB is not defined.
                      #endif
                      
                      1 Reply Last reply
                      1
                      • C Christian Ehrlicher
                        7 Jun 2023, 18:59

                        I did not see (and not use by myself) qt_standard_project_setup() so you're correct with the automoc.

                        You use the same define for the export definition for both libraries - how should this work?

                        M Offline
                        M Offline
                        Mesrine
                        wrote on 7 Jun 2023, 19:06 last edited by Mesrine 6 Jul 2023, 19:25
                        #41

                        @Christian-Ehrlicher
                        Thats a good point. Thanks!
                        Using the same definition for both libraries if not included correctly the headers could define the export on the symbol that should have an import statement.

                        This is not completely clear to me so Let me try.
                        I let you know :).

                        Yes, that was the problem. Many thanks.

                        1 Reply Last reply
                        0
                        • M Mesrine has marked this topic as solved on 7 Jun 2023, 19:22

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved