#include <iostream>
#include <conio.h>
#include <vector>
#include <cstdio>
#include "color.h"
#include <curses.h>
using namespace std;
using namespace ConsoleColor;
namespace color = ConsoleColor;
int i, n;
char input, white_space = 250, obstacle_default = 219, player=1, up_key=119, down_key=115, left_key=97, right_key=100;
class box {
int x, y, pos, pos_x, pos_y, area;
vector<int> obstacles;
public:
box (int,int);
void print (void);
void move (void);
void set_obstacles (vector<int> v);
};
int main()
{
box main_hallway(50,10);
vector<int> obstacle_list={1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40};
main_hallway.set_obstacles(obstacle_list);
main_hallway.move();
return 0;
}
[...]
与上面的代码,包括来自pdcurses库curses.h后,我立即得到这些两个错误:诅咒误差与C++类
27:错误:预期“;”错误:“main_hallway”
28“之前main_hallway”没有在此范围
代码工作完美事先宣布,但pdcurses加...看来它不喜欢带班同意。有没有办法来解决这个问题?
附加信息:
- Windows Vista中专业
- 代码:: Blocks的10.04 + MINGW32
- PDCurses 3.4
没有错误在你表现出什么。错误代码中没有发布。如果它不是太大,请在'main()'之前发布整个代码片段。 – Mahesh 2011-03-24 01:41:57
我已经编辑了主要帖子,包括上面的所有内容,包括int main() – 2011-03-24 02:02:36
@Captain - 只有系统头文件需要在<<>中。所以,试试这个'#include“curses.h”'。 – Mahesh 2011-03-24 02:06:17