我有一个C++类,可以在linux上使用gcc和visual studio中的寡妇进行编译.
boid.h:
#ifndef BOID_CLASS_HEADER_DEFINES_H
#define BOID_CLASS_HEADER_DEFINES_H
#include "defines.h"
class Boid {
public:
// Initialize the boid with random position, heading direction and color
Boid(float SceneRadius,float NormalVel);
.....
protected:
...
};
#endif
Run Code Online (Sandbox Code Playgroud)
并在boid.cpp中:
#include "Boid.h"
// Initialize the boid with random position, heading direction and color
Boid::Boid(float SceneRadius,float NormalVel)
{
....
}
Run Code Online (Sandbox Code Playgroud)
但是,当我在Xcode中编译此代码时,我收到以下错误:
Compiling Boid.h: "error: vector: No such file or directory"
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?我以为你可以使用C/C++代码并在Xcode中编译它而没有问题?
谢谢
编辑:添加了define.h(还将#endif添加到示例中,但是在原始代码中)
编辑2:在评论出几个包括空的时间后,我得到了一个不同的错误:上面的向量错误.
#ifndef BOID_NAV_DEFINES_H
#define BOID_NAV_DEFINES_H
#include <stdlib.h>
#include <vector>
#include "Vector3d.h"
#include "Point3d.h" …Run Code Online (Sandbox Code Playgroud)