我只是看到这是由人们在构建时没有将他们的类对象链接在一起引起的,但我有,而且我不确定是什么问题.
来源:
//test.cpp
#include "Point.h"
#include "Sphere.h"
#include "Scene.h"
int main(){
Sphere s;
Scene sc;
sc.img_plane.upper_left = Point(-1, 1, -3);
sc.img_plane.upper_right = Point(1, 1, -3);
sc.img_plane.lower_left = Point(-1, -1, -3);
sc.img_plane.lower_right = Point(1, -1, -3);
sc.width = 100;
sc.height = 100;
return 0;
}
错误:
test.cpp:(.text+0x17): undefined reference to `Sphere::Sphere()'
test.cpp:(.text+0x26): undefined reference to `Scene::Scene()'
test.cpp:(.text+0x192): undefined reference to `Scene::~Scene()'
test.cpp:(.text+0x1a1): undefined reference to `Sphere::~Sphere()'
test.cpp