C++ 如何修复';g++;:致命错误:未终止任何输入文件编译;错误

C++ 如何修复';g++;:致命错误:未终止任何输入文件编译;错误,c++,c,makefile,gnu-make,directory-structure,C++,C,Makefile,Gnu Make,Directory Structure,我的第一个更大的makefile项目遇到了一些问题。 我在我的C++项目中使用了一个更大的库。更准确:在我的.cpp文件和.h文件中,我需要包含这个更大库中的一些头文件 以下是我的结构,让您知道我如何在项目中使用库: myproj | |____Makefile |____main.cpp |____init.cpp |____end.cpp |____init.h |____end.h |____Dependencies |____bigg

我的第一个更大的makefile项目遇到了一些问题。 我在我的C++项目中使用了一个更大的库。更准确:在我的.cpp文件和.h文件中,我需要包含这个更大库中的一些头文件

以下是我的结构,让您知道我如何在项目中使用库:

myproj
  |
  |____Makefile
  |____main.cpp
  |____init.cpp
  |____end.cpp
  |____init.h
  |____end.h
  |____Dependencies
           |____biggerlib
                   |____bin   
                           |____...
                   |____include
                           |____#more directories including
                                #the Library headers
                           |____...
                   |____src
                           |____biggerLib1
                           |____biggerLib2
                                   |____biggerLibrary.cpp
                                          |____...
                                   |____Lib2.cpp
                                          |____...
                                   |____Lib3.cpp
                                          |____...
                                   |____Util
                                          |____DebugOut.cpp
                                   |____Dev
                                   |____Data
                                          |____etc.
                   |____makestuff
                           |____...
                           |____...
                                   |____...
                           |____...
                   |____codestuff
                           |____...
                           |____...
                                   |____...
                           |____...
                   |____etc.
我不允许改变这种结构

所以,我的问题是,如果我开始make,gcc或g++找不到我的输入文件。 错误代码:

g++: fatal error: no input files
compilation terminated.
*makefileName*:21: recipe for target '*Name*' failed
make: *** [*Name*] Error 1
因此,以下是我的makefile中的一些内容: 首先,我的对象文件:

OBJECTS += \
$(BUILD)main.o \
$(BUILD)init.o \
$(BUILD)end.o 
然后我的makefile:

#Name (output name / project name)
NAME = proj

#Compiler directory
CC = gcc
CPP = g++
#Libray directorys
SDCC = /home/myname/myproj/Dependencies/biggerlib/src/biggerLib2/Util

# the headers are working well since yesterday but now i got the trouble with the input stuff...

#C-Flags for object-compiling
CFLAGS = -O2 -g3 -c -I$(SDCHDR) -I$(SDCDATAMODEL) -I$(SDCPOCO) #may i have to add here the source files too? did not work...

#Main-target (linking)
$(NAME) : $(OBJECTS)
    $(CPP) -o $(NAME) -I$(SDCC)/DebugOut.cpp ## this one was just to try if I could bind in one single .h file... 

#Object-targets
%.o : %.cpp 
    $(CPP) -o $@ $< $(CFLAGS)

因此,如果你们中的任何人都知道如何在不改变目录结构的情况下包含丢失的输入文件,那就太好了。

我认为cmake的可能副本很容易扩展,您可以尝试为新项目查找cmake;这是一个构建生成器工具。Cmake可能不是我的选项:(我需要使用make来将其包含在waay bigge项目的其他make文件中猜测不会起作用!您从未设置
$(对象)
您试图将源文件作为包含路径传递。在构建makefile时,您使用的参考资料是什么?我确实设置了它们,但没有显示给您,因为我认为yall不需要这样做。我有一个外部对象文件
make -f makefilename