Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
218 views
in Technique[技术] by (71.8m points)

c++ - gcc can't find header file

I have this main in a project in c++ but I can't compile it in gcc due to this error:

In file included from main.cpp:11:
../framework/application.h:8:10: fatal error: includes.h: El fitxer o directori no existeix
    8 | #include "includes.h"
      |          ^~~~~~~~~~~~

What it says is that the file "includes.h" doesn't exist. It exist but is in another directory and I don't know how to compile using a header from another directory.

I tried:

gcc -I ../framework/ main.cpp 
gcc -I../framework/ main.cpp
gcc -I "../framework/" main.cpp

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Testing on my machine with a similar directory structure using the I directive worked for me. Ensure that your path is correct and I would even try using an absolute path as a test.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

63 comments

56.7k users

...