我有一个问题我试图使用GNU g ++一起编译多个文件
我们假设有五个文件:
main.cpp : the main function 
a.h      : the header file of class A 
a.cpp    : the definition of class A 
b.h      : the header file of class B 
b.cpp    : the definition of class B 
在程序中,main.cpp使用类A(因此包括啊),类A使用类B(因此包括bh).
所以在我的主要内容中我刚刚添加了#include"啊"
我正在尝试使用它来编译它
g++ main.cpp -o main
但这不起作用.它给了我一个"未定义的引用"错误.当我将所有类与头文件一起编译时,程序为我提供了所需的输出
有人可以告诉我哪里出错了