S
S
sddvxd2018-08-01 16:47:47
C++ / C#
sddvxd, 2018-08-01 16:47:47

How to include a folder with headers?

Hello
In the folder with the compiler are the necessary files to work with winapi. I am writing through CLion and I need to somehow connect this folder, the environment does not want to index files connected via include

#include "tlhelp32.h"
CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL); // Can't resolve variable //'CreateToolhelp32Snapshot'

I'm trying to include these files like this:
include_directories(C:\\Program Files\\mingw-w64\\x86_64-7.3.0-posix-seh-rt_v5-rev0\\mingw64\\x86_64-w64-mingw32\\include) #в этой папке tlhelp32.h

add_executable(untitled ...  tlhelp32.h)

Does not exceed. Please tell me how best to do it right

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
GavriKos, 2018-08-01
@GavriKos

Isn't
it necessary through?
If I remember the pluses correctly, then in quotes we write the path relative to the current compilation unit.

4
4rtzel, 2018-08-01
@4rtzel

The first thing that catches your eye is the presence of spaces in the path to the folder. Try putting it in quotes:
About the correctness:
Generally speaking, the use of include_directories is considered bad manners and the structure of modern CMake should be based on targets and properties. Your description lacks a bit of data to understand what you want to get. It would be nice if you could provide the full CMake code and describe what you are trying to get.
Or you can also check out my other answer on building an application with CMake.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question