I am working on a C++ project that has to be compiled using a Makefile. The project requiring various sources and headers, I decided to organize them in different directories inside the project. My situation looks like this (fake example):
In the main.cpp file I try to include a_bis.hpp with the line:
#include "a/a_bis/a_bis.hpp"
When compiling I get the error message a/a_bis/a_bis.hpp: No such file or directory. From what I understood I need to add the -I flag to the compiling command. Here is what it looks like:
g++ -Wall -Wextra -Werror -I"D:\C++\test" main.cpp
The path is correct, but I keep getting the same error. I tried other syntaxes ( -I/D/C++/test, -I"D:\C++\test"). Looking online I see the same syntax over and over again, which I already tried.
Does someone have any clue of what might cause this issue?
This project is a school project and I am forbidden of using any cmake tool. Thanks for any help!
Thanks for your help, I found the issue. I am using the regular path of my Windows system but I executed the make commands using a WSL terminal. When executing the make command in a Powershell terminal there seems to be no problem using the syntax pointed out by MadScientist's comment ( -ID:/C++/test
).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.