Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. CMake issues
Forum Updated to NodeBB v4.3 + New Features

CMake issues

Scheduled Pinned Locked Moved Unsolved 3rd Party Software
2 Posts 2 Posters 553 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.
  • G Offline
    G Offline
    goswami
    wrote on last edited by
    #1

    I have recently installed Qt Creator 7.0.2 with 'cmake' build option in ubuntu linux at the time of installation i.e. not separately. Single file the same is working alright but when going for multi file difficult with .h files. For a simple hello project against the following CMakeLists.txt file it is failing.
    "cmake_minimum_required(VERSION 3.5)
    project(FMI-Test LANGUAGES C)
    set(SOURCES src/sample.cpp)
    set(HEADERS include/sample.h)
    add_executable(app main.c ${SOURCES} ${HEADERS})
    target_include_directories(app PUBLIC include)"
    However on running cmake from build option the project creating is not showing the include folder where sample.h file is kept, instead it is showing in the project folder under 'Header Files' folder unlike what is in File System. It is failing in building reporting 'undefined reference' of the function declared in sample.h file. However if I change #include sample.h in main.c file to #include sample.cpp it works. I have seen from command line the same result. Can anybody point out what the problem is?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Why are you stating that your application's language is C when using in fact C++ ? (That's what the .cpp extension hints to).

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      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