I have the following structure of my project:
Project
-- CMakeLists.txt
-- src/
-- -- main.cpp
-- include/
-- -- curl/
-- -- -- *.h files
-- -- nlohmann/
-- -- -- *.hpp files
-- lib/
-- -- libcurl.lib
Project/CMakeLists:
cmake_minimum_required(VERSION 3.1)
set(PROJECT_NAME "VKAPI")
project(${PROJECT_NAME} CXX)
include_directories(${PROJECT_SOURCE_DIR}/include)
file(GLOB TARGET_SRC "./src/*.cpp")
add_executable(main ${TARGET_SRC})
target_link_libraries(main "${CMAKE_SOURCE_DIR}/lib/libcurl.lib")
install(TARGETS main DESTINATION bin)
It works fine, but when I launch main.exe, it doesn't work. Instead of executing correctly and displaying the message, it ends with the code 0. Code:
#include <iostream>
#include "curl/curl.h"
#include "nlohmann/json.hpp"
int main()
{
CURL* curl = curl_easy_init();
std::cout << "That's work!" << std::endl;
std::cout << "Hello Easy C++ project!" << std::endl;
}
But when I delete "#include "curl/curl.h""
and "#include "nlohmann/json.hpp""
, it started to work fine.