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. Linking libs on moved project from Win/VS 2022 to RaspbianOS/QtCreator

Linking libs on moved project from Win/VS 2022 to RaspbianOS/QtCreator

Scheduled Pinned Locked Moved Solved Installation and Deployment
5 Posts 2 Posters 628 Views 1 Watching
  • 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.
  • J Offline
    J Offline
    Jacobotto
    wrote on last edited by
    #1

    Hi all,

    So I'm trying to move my project that includes some Qt libraries and also external one.
    In VS I'm doing it like that in project's properties:
    In C/C++->General->Additional Include Directories you must set the Qt installation include path;
    In Linker->General->Additional Library Directories you must add the path of .libs files of your qt installation;
    In Linker->Input->Additional Dependencies you must put the name of .lib files that you need in order to build the project.

    In QtCreator on RaspbianOS I have mostly issue with QtNetwork libraries for now when debugging, as I'm getting e.g. "undefined reference to 'QNetworkAccessManager (...)"

    When moving I've just created the new Qt console project, copied my code and filled .pro file. I'm including in main.cpp like this:

    #include <QtNetwork/QNetworkAccessManager>
    #include <QtNetwork/QNetworkRequest>
    #include <QtNetwork/QNetworkReply>
    #include <nlohmann/json.hpp>
    

    ..and this is what I've added to .pro file:

    INCLUDEPATH += /home/jakub/Downloads/json-develop/include
    INCLUDEPATH += /usr/include/i386-linux-gnu/qt5
    

    What did i miss?

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      You need to add the network module to your qmake project. In the .pro file there's a QT += line. Add network there and re-run qmake (from the Build menu). qmake will then add the necessary paths and libs to your build config.

      If you look at the documentation for Qt classes there's always information near the top what module you need for given class e.g. QT += network for QNetworkAccessManager

      J 1 Reply Last reply
      1
      • Chris KawaC Chris Kawa

        You need to add the network module to your qmake project. In the .pro file there's a QT += line. Add network there and re-run qmake (from the Build menu). qmake will then add the necessary paths and libs to your build config.

        If you look at the documentation for Qt classes there's always information near the top what module you need for given class e.g. QT += network for QNetworkAccessManager

        J Offline
        J Offline
        Jacobotto
        wrote on last edited by
        #3

        @Chris-Kawa It solved the issue, thank you very much!

        1 Reply Last reply
        0
        • J Offline
          J Offline
          Jacobotto
          wrote on last edited by
          #4

          Sorry for writing here again, didn't want to start new topic. I've noticed that deleting/commenting std libraries changes nothing. I mean the program can be rebuild and normally works, e.g. removing #include <string> when I'm using lot of std::string variables is completely fine. How it happens, what part of code includes them?

          1 Reply Last reply
          0
          • Chris KawaC Offline
            Chris KawaC Offline
            Chris Kawa
            Lifetime Qt Champion
            wrote on last edited by Chris Kawa
            #5

            It most probably gets included transitionally by some other headers. Most compilers have a switch to print out include hierarchy for compiled files, so you can use it and search for /string or /string.h in the compilation output pane.
            For MSVC you would add QMAKE_CXXFLAGS += /showIncludes in the .pro file. GCC has similar QMAKE_CXXFLAGS += -H option.

            1 Reply Last reply
            1

            • Login

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