Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. Set up additional include paths and library paths
Forum Updated to NodeBB v4.3 + New Features

Set up additional include paths and library paths

Scheduled Pinned Locked Moved Unsolved Qt 6
4 Posts 2 Posters 715 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.
  • P Offline
    P Offline
    Phil7789
    wrote on 8 Jul 2022, 14:07 last edited by
    #1

    Hello,

    I wanted to develop a small program for Microsoft Flight Simulator (2020) with SimConnect.
    In Visual Studio I could just

    • add an additional include path (which is $(MSFS_SDK)\SimConnect SDK\include where MSFS_SDK is a PATH var) in project settings -> C/C++
    • add a library path in project settings -> Linker -> common (which is $(MSFS_SDK)\SimConnect SDK\lib)
    • add additional dependencies in project settings -> Linker -> input (which are SimConnect.lib; shlwapi.lib; user32.lib; Ws2_32.lib;)

    After several hours of googling and trial and error I'm still not able to include any of it. I've seen that with qmake I could add additional libraries but I would have to specify a path for each indiviual library (I only know the path for SimConnect.lib, I assume the rest are system libraries).
    It shouldn't be a big difference but I tried to stick to cmake as the SDK suggests and I couldn't find any GUI solution (like in VS) to implement those additions I need.

    I've tried to include the path for SimConnect.h with
    target_include_directories(FlyShare PRIVATE "${MSFS_SDK}/SimConnect SDK/include")
    and with
    include_directories("${MSFS_SDK}/SimConnect SDK/include")
    but with neither I am actually able to use #include "SimConnect.h" as it cannot be found. How to include the .libs is even more beyond my understanding.

    Is there a way to include above mentioned additions in an easy way like in VS I didn't find yet?
    If it has to be done via file edits (CMakeLists.txt) could perhaps somebody point out for me how to do this?
    I couldn't find any solution on the web how to do this properly.

    Link to MSFS SDK Docs that show the setup in VS: https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/SimConnect_SDK.htm
    (scroll down to C/C++ projects)

    Thanks in advance,
    Phil

    C 1 Reply Last reply 8 Jul 2022, 14:19
    0
    • P Phil7789
      8 Jul 2022, 14:07

      Hello,

      I wanted to develop a small program for Microsoft Flight Simulator (2020) with SimConnect.
      In Visual Studio I could just

      • add an additional include path (which is $(MSFS_SDK)\SimConnect SDK\include where MSFS_SDK is a PATH var) in project settings -> C/C++
      • add a library path in project settings -> Linker -> common (which is $(MSFS_SDK)\SimConnect SDK\lib)
      • add additional dependencies in project settings -> Linker -> input (which are SimConnect.lib; shlwapi.lib; user32.lib; Ws2_32.lib;)

      After several hours of googling and trial and error I'm still not able to include any of it. I've seen that with qmake I could add additional libraries but I would have to specify a path for each indiviual library (I only know the path for SimConnect.lib, I assume the rest are system libraries).
      It shouldn't be a big difference but I tried to stick to cmake as the SDK suggests and I couldn't find any GUI solution (like in VS) to implement those additions I need.

      I've tried to include the path for SimConnect.h with
      target_include_directories(FlyShare PRIVATE "${MSFS_SDK}/SimConnect SDK/include")
      and with
      include_directories("${MSFS_SDK}/SimConnect SDK/include")
      but with neither I am actually able to use #include "SimConnect.h" as it cannot be found. How to include the .libs is even more beyond my understanding.

      Is there a way to include above mentioned additions in an easy way like in VS I didn't find yet?
      If it has to be done via file edits (CMakeLists.txt) could perhaps somebody point out for me how to do this?
      I couldn't find any solution on the web how to do this properly.

      Link to MSFS SDK Docs that show the setup in VS: https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/SimConnect_SDK.htm
      (scroll down to C/C++ projects)

      Thanks in advance,
      Phil

      C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 8 Jul 2022, 14:19 last edited by
      #2

      @Phil7789 said in Set up additional include paths and library paths:

      ${MSFS_SDK}

      This is wrong - see the cmake documentation on how to read anvironment variables.

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

      P 1 Reply Last reply 8 Jul 2022, 18:47
      1
      • C Christian Ehrlicher
        8 Jul 2022, 14:19

        @Phil7789 said in Set up additional include paths and library paths:

        ${MSFS_SDK}

        This is wrong - see the cmake documentation on how to read anvironment variables.

        P Offline
        P Offline
        Phil7789
        wrote on 8 Jul 2022, 18:47 last edited by
        #3

        @Christian-Ehrlicher

        Oh I misinterpreted the part of solution I found on SO. I thought Cmake would resolve vars without the addition of ENV. Thank you.

        With your hint I managed to include the header file, but only when using include_directories().
        When I use include_target_directories(myProject PRIVATE "$ENV{MSFS_SDK}\\SimConnect SDK\\include") (which is below qt_add_executable(...)) the header file is not found again.
        I've also tried to add a target_link_directories() just to be sure.

        Are shlwapi.lib; user32.lib; Ws2_32.lib; automatically included in Qt or do I have to specify the full path for them too (I assume they're all system32 libs)?

        C 1 Reply Last reply 8 Jul 2022, 19:33
        0
        • P Phil7789
          8 Jul 2022, 18:47

          @Christian-Ehrlicher

          Oh I misinterpreted the part of solution I found on SO. I thought Cmake would resolve vars without the addition of ENV. Thank you.

          With your hint I managed to include the header file, but only when using include_directories().
          When I use include_target_directories(myProject PRIVATE "$ENV{MSFS_SDK}\\SimConnect SDK\\include") (which is below qt_add_executable(...)) the header file is not found again.
          I've also tried to add a target_link_directories() just to be sure.

          Are shlwapi.lib; user32.lib; Ws2_32.lib; automatically included in Qt or do I have to specify the full path for them too (I assume they're all system32 libs)?

          C Offline
          C Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 8 Jul 2022, 19:33 last edited by Christian Ehrlicher 7 Aug 2022, 19:33
          #4

          @Phil7789 said in Set up additional include paths and library paths:

          include_target_directories

          it's target_include_directories(), also please try with forward slashes

          Are shlwapi.lib; user32.lib; Ws2_32.lib; automatically included in Qt or do I have to specify the full path for them too (I assume they're all system32 libs)?

          Not by Qt, but the default linker search path.

          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

          1/4

          8 Jul 2022, 14:07

          • Login

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