我宣布这个类 '机器人':静态常量不可访问的类定义(C++)
#ifndef ROBOT_H
#define ROBOT_H
class Robot {
private:
static const int N_ROBOT_JOINTS = 5;
static const int JOINT_PARAM_D1 = 275;
static const int JOINT_PARAM_A2 = 200;
static const int JOINT_PARAM_A3 = 130;
static const int JOINT_PARAM_D5 = 130;
public:
Robot();
float* forwardKinematics(int theta[N_ROBOT_JOINTS]);
};
#endif
Robot.cpp
#include "stdafx.h"
#include "Robot.h"
//#define _USE_MATH_DEFINES
//#include <math.h>
Robot::Robot(void)
{
}
float* forwardKinematics(int theta[Robot::N_ROBOT_JOINTS])
{
float* array_fwdKin = new float[Robot::N_ROBOT_JOINTS];
float p_x, p_y, p_z, pitch, roll;
for (int i = 0; i < Robot::N_ROBOT_JOINTS; i++)
{
}
return array_fwdKin;
}
,但是当我尝试编译我得到这个错误:
6智能感知:部件 “机器人:: N_ROBOT_JOINTS”(在第9行中声明的 “e:\文件\视觉工作室2012 \项目\机器人运动学\机器人运动学\ Robot.h”)为i naccessible E:\文档\的Visual Studio 2012 \项目\机器人运动学\机器人运动学\ Robot.cpp 10个43个机器人运动学
感谢ü乌拉圭回合帮助
Robot
一员,工作! ;) –