當使用Visual Studio 2013編譯我的錯誤非法引用非靜態成員在一個struct
illegal reference to non-static member 'Ice::Constants::Tau
這是所有相關的代碼
的Maths.hpp
#ifndef ICE_MATHS_DEFINES_H
#define ICE_MATHS_DEFINES_H
#include "Vec2.hpp"
#include "Vec3.hpp"
#include "Vec4.hpp"
#include "Mat4.hpp"
#include "Quaternion.hpp"
namespace Ice
{
struct Constants
{
static constexpr f32 Pi = 3.14159265359;
static constexpr f32 Tau = 6.28318530718;
};
}
#endif
engine.cpp中違規代碼行
_context_scene.projection = perspective(Constants::Tau, aspect_ratio, 0.1f, 100.0f);
透視功能
Mat4 perspective(f32 fov, f32 aspect, f32 near, f32 far);
顯示'perspective'的定義。例如,如果它通過參考來考慮價值,那麼知道這一點很重要。 –
我不會使用以下劃線開頭的名字(它們在全局命名空間中是不允許的) – user463035818
'perspective'是一個函數還是一個類的成員? –