2

I want to use a library called HDFQL in a C++ project in VSCode. I am trying to use the extension CMake Tools as much as possible. HDFQL is a header library and usually I would write the following CMakeLists.txt:

cmake_minimum_required(VERSION 3.2)
project(project_name)
add_compile_options(-std=c++11)

set(HDFQL_ROOT "path/to/hdfql-2.1.0")
include_directories(${HDFQL_ROOT}/include)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_FLAGS "-std=c++11 -pthread ${CMAKE_CXX_FLAGS}")

add_executable(
    ${PROJECT_NAME}
    # your source file 1
    # your source file 2 
    # ...
)
include_directories("${HDFQL_ROOT}/include")
target_link_libraries(
   ${PROJECT_NAME}
   "${HDFQL_ROOT}/wrapper/cpp/libHDFql.so"
)

I am only trying to get 'hello world' to work right now:

#include <iostream>
#include "HDFql.hpp"

int main(int argc, char** argv) {
   std::cout << "Hello world" << std::endl;
   return 0;
}

But even if I manually write my CMakeLists.txt in VS Code, I get cannot open source file HDFql.hpp. What do I need to do to add external header files to a VS Code C++ project using Cmake Tools?

Many thanks!

Mr Squid
  • 1,196
  • 16
  • 34
  • set(HDFQL_ROOT "path/to/hdfql-2.1.0") this has been changed in your actual code? This is called twice: include_directories(${HDFQL_ROOT}/include) and further down: include_directories("${HDFQL_ROOT}/include") – g.stevo Sep 29 '22 at 06:43

0 Answers0