【问题标题】:Makefile for different .cpp files in different folders不同文件夹中不同 .cpp 文件的 Makefile
【发布时间】:2015-04-21 14:49:36
【问题描述】:

我有以下文件夹结构:

项目项目:

  • 文件夹 1
    • sourceFile1_1.cpp
    • sourceFile1_2.cpp
  • 文件夹2
    • sourceFile2.cpp
  • 文件夹 3
    • sourceFile3.cpp
  • main.cpp
  • 制作文件

我想创建一个构建项目的生成文件。源文件之间可以有依赖关系,但不存在循环依赖关系。

这是我现在的makefile:

all: project.exe

clean:
    rm main.o project.exe

project.exe: main.o
    g++ -g -o main main.o

main.o:
    g++ -c -g  main.cpp 

但是当我运行它时,我得到Cannot open include file: 'whatever....h': No such file or directory

有人知道我做错了吗?

【问题讨论】:

  • 使用-I 选项指定标头路径

标签: c++ eclipse windows gcc


【解决方案1】:

cannot open include file,表示编译器找不到文件。编译器使用包含路径来搜索包含文件。您可以查看文档here,了解有关如何设置此包含路径的更多信息。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-21
    • 1970-01-01
    • 2020-08-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多