Include header file in different directory in c++

前端 未结 3 1267
谎友^
谎友^ 2021-01-17 18:37

I\'ve been learning c++ and encountered the following question: I have a directory structure like:

 - current directory

  - Makefile

  - include

     - he         


        
3条回答
  •  甜味超标
    2021-01-17 19:11

    You told the Makefile that include/header.h must be present, and you told the C++ source file that it needs header.h … but you did not tell the compiler where such headers live (i.e. in the "include" directory).

    Do this:

    CFLAGS = -c -Wall -Iinclude
    

提交回复
热议问题