作者:
shiburin (廢文製造機)
2021-01-18 16:33:06問題(Question):
無法使用 header 裡 class 的變數
錯誤結果(Wrong Output):
...does not name a type...
程式碼(Code):(請善用置底文網頁, 記得排版,禁止使用圖檔)
header file:
#include<vector>
#include<glm/glm.hpp>
class polygon {
public:
polygon() {}
polygon(std::vector<glm::vec2> vec): vertices(vec) {}
std::vector<glm::vec2> vertices;
};
_____________________________
main.cpp:
polygon cube;
^^^
這行沒問題
cube.vertices = std::vector<glm::vec2> { glm::vec2(0.0, 0.0) };
^^^
在這裡出錯 'cube' does not name a type