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 781 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 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

    Christian EhrlicherC 1 Reply Last reply
    0
    • P Phil7789

      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

      Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 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
      1
      • Christian EhrlicherC Christian Ehrlicher

        @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 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)?

        Christian EhrlicherC 1 Reply Last reply
        0
        • P Phil7789

          @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)?

          Christian EhrlicherC Online
          Christian EhrlicherC Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by Christian Ehrlicher
          #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

          • Login

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