编译下面的代码g++ main.cpp functions.cpp -o run
给了我错误error: ‘vector’ does not name a type
。在顶部声明命名空间main.cpp
通常适用于我的所有.cpp
文件。
主文件
using namespace std;
#include "functions.h"
main () {}
函数.h
#include <vector>
函数.cpp
#include "functions.h"
vector <int> x;
编辑:我很欣赏所有响应者都知道他们在说什么的事实,但这通常对我有用。使用makefile会对此有任何影响吗?还有什么我可能会错过的吗?