Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. compiling c++ library with web assembly
QtWS25 Last Chance

compiling c++ library with web assembly

Scheduled Pinned Locked Moved Solved Installation and Deployment
9 Posts 2 Posters 1.3k 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.
  • I Offline
    I Offline
    Izza
    wrote on last edited by
    #1

    hello,
    I am new to webassembly and qt . I have myown library written in qt called QcStyle.

    and it has a small project call designer. To compile designer it needs QcStyle. But when i place
    insid my makefile all QcStyle .cpp files it gives
    "multiply definition error famous for c++ .

    Since all the ,o files are accessing the same include path , i am having this problem of duplicate.
    Can anyone suggest better ide ahow to compile C++ library in webassembly please and then including in my project.
    Thanks in advance.

    raven-worxR 1 Reply Last reply
    0
    • I Izza

      hello,
      I am new to webassembly and qt . I have myown library written in qt called QcStyle.

      and it has a small project call designer. To compile designer it needs QcStyle. But when i place
      insid my makefile all QcStyle .cpp files it gives
      "multiply definition error famous for c++ .

      Since all the ,o files are accessing the same include path , i am having this problem of duplicate.
      Can anyone suggest better ide ahow to compile C++ library in webassembly please and then including in my project.
      Thanks in advance.

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @Izza said in compiling c++ library with web assembly:

      Can anyone suggest better ide ahow to compile C++ library in webassembly please and then including in my project.

      compile it independently first.
      Then in your main project link against the lib.
      Pretty much the same like you would do in a plain C++/Qt project.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • I Offline
        I Offline
        Izza
        wrote on last edited by
        #3

        I have compiled it, and it has generated all .o files for library

        What i now did is, in my make file plave .o for my library project and created single .o file for it and passed that .o in the linker ...
        But still i need to produce moc_ files aswel... lets see..

        1 Reply Last reply
        0
        • I Offline
          I Offline
          Izza
          wrote on last edited by
          #4

          Can you suggest a script to produce .a file instead .
          And mocing multiple header files of C++
          since moc is not taking multiple header files in one command, I do not want to do menually to many headers.

          raven-worxR 1 Reply Last reply
          0
          • I Izza

            Can you suggest a script to produce .a file instead .
            And mocing multiple header files of C++
            since moc is not taking multiple header files in one command, I do not want to do menually to many headers.

            raven-worxR Offline
            raven-worxR Offline
            raven-worx
            Moderators
            wrote on last edited by raven-worx
            #5

            @Izza
            easiest is to create a new .pro file with all sources and specify TEMPLATE=lib
            and also build it with QtWebAssembly

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            2
            • I Offline
              I Offline
              Izza
              wrote on last edited by
              #6

              My .pro file for library:

              TEMPLATE = lib
              TARGET = QcStyle
              INCLUDEPATH += .
              QTPLUGIN += qjpeg qgif

              The following define makes your compiler warn you if you use any

              feature of Qt which has been marked as deprecated (the exact warnings

              depend on your compiler). Please consult the documentation of the

              deprecated API in order to know how to port your code away from it.

              DEFINES += QT_DEPRECATED_WARNINGS

              You can also make your code fail to compile if you use deprecated APIs.

              In order to do so, uncomment the following line.

              You can also select to disable deprecated APIs only up to a certain version of Qt.

              #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

              Input

              HEADERS += Function.h
              headers.h
              pcheader.h
              Style.h
              Tree.h
              Utilities.h
              Base/Application.h
              Base/BidirectionalBinding.h
              Base/Debug.h
              Base/Font.h
              Base/Function.h
              Base/ItemGrabber.h
              Base/ListModel.h
              Base/Locale.h
              Base/NumberUnit.h
              Base/NumberUnitHelpers.h
              Base/Persistence.h
              Base/SignalWrapper.h
              Base/SmartBinding.h
              Base/Theme.h
              Base/Translator.h
              Base/Unit.h
              Control/Flex.h
              Control/Flickable.h
              Control/Pinchable.h
              Control/SelectGroup.h
              designer/pcheader.h
              designer/version.h
              JSExtension/JSExtension.h
              Layout/MessageLauncher.h
              Misc/Analytics.h
              Misc/ArcGraph.h
              Misc/EdgeGraph.h
              Misc/Hash.h
              Misc/LexerHelpers.h
              Misc/ObjectNotify.h
              Misc/SpaceShortcut.h
              QcStyleUnitTests/Config.h
              QcStyleUnitTests/version.h
              Control/Input/SearchParamModel.h
              Control/Search/CloudTagFilterParams.h
              Control/Search/FilterParams.h
              Control/Search/FilterParamsList.h
              Control/Search/FlipFlopFilterParams.h
              Control/Search/NumberUnitComparatorFilterParams.h
              Control/Search/NumberUnitFilterParams.h
              Control/Search/RangeSliderFilterParams.h
              Control/Search/ScoreFilterParams.h
              Control/Search/SearchModel.h
              Control/Search/SearchParams.h
              Control/Search/SortParams.h
              Control/Search/SpinBoxFilterParams.h
              designer/Test/SGTest.h
              SOURCES += pcheader.cpp
              Style.cpp
              Utilities.cpp
              Base/Application.cpp
              Base/BidirectionalBinding.cpp
              Base/Debug.cpp
              Base/Font.cpp
              Base/ItemGrabber.cpp
              Base/ListModel.cpp
              Base/Locale.cpp
              Base/NumberUnit.cpp
              Base/NumberUnitHelpers.cpp
              Base/Persistence.cpp
              Base/SignalWrapper.cpp
              Base/SmartBinding.cpp
              Base/Theme.cpp
              Base/Translator.cpp
              Base/Unit.cpp
              Control/Flex.cpp
              Control/Flickable.cpp
              Control/Pinchable.cpp
              Control/SelectGroup.cpp
              designer/designer_plugin_import.cpp
              designer/main.cpp
              JSExtension/JSExtension.cpp
              Misc/Analytics.cpp
              Misc/LexerHelpers.cpp
              Misc/ObjectNotify.cpp
              Misc/SpaceShortcut.cpp
              QcStyleUnitTests/ArcGraph.cpp
              QcStyleUnitTests/main.cpp
              Control/Input/SearchParamModel.cpp
              Control/Search/CloudTagFilterParams.cpp
              Control/Search/FilterParams.cpp
              Control/Search/FilterParamsList.cpp
              Control/Search/FlipFlopFilterParams.cpp
              Control/Search/NumberUnitComparatorFilterParams.cpp
              Control/Search/NumberUnitFilterParams.cpp
              Control/Search/RangeSliderFilterParams.cpp
              Control/Search/ScoreFilterParams.cpp
              Control/Search/SearchModel.cpp
              Control/Search/SearchParams.cpp
              Control/Search/SortParams.cpp
              Control/Search/SpinBoxFilterParams.cpp
              designer/Test/SGTest.cpp
              TRANSLATIONS += translations/Strings.ar.ts
              translations/Strings.de.ts
              translations/Strings.es.ts
              translations/Strings.fr.ts
              translations/Strings.he.ts
              translations/Strings.it.ts
              translations/Strings.ja.ts
              translations/Strings.ko.ts
              translations/Strings.pl.ts
              translations/Strings.pt.ts
              translations/Strings.ru.ts
              translations/Strings.tr.ts
              translations/Strings.ts
              translations/Strings.zh_CN.ts
              translations/Strings.zh_TW.ts

              1 Reply Last reply
              0
              • I Offline
                I Offline
                Izza
                wrote on last edited by
                #7

                ok I have created .a file but how to link it with project now?

                raven-worxR 1 Reply Last reply
                0
                • I Izza

                  ok I have created .a file but how to link it with project now?

                  raven-worxR Offline
                  raven-worxR Offline
                  raven-worx
                  Moderators
                  wrote on last edited by
                  #8

                  @Izza
                  https://doc.qt.io/qt-5/third-party-libraries.html

                  --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                  If you have a question please use the forum so others can benefit from the solution in the future

                  1 Reply Last reply
                  1
                  • I Offline
                    I Offline
                    Izza
                    wrote on last edited by
                    #9

                    Thanks alot

                    1 Reply Last reply
                    0

                    • Login

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