C++ запрещает преобразование строковой константы в char [закрыто]C++

Программы на C++. Форум разработчиков
Anonymous
 C++ запрещает преобразование строковой константы в char [закрыто]

Сообщение Anonymous »

Я настроил vscode для проекта igraphics в соответствии с инструкциями https://drive.google.com/file/d/1YLd8IN ... sp=sharing в этом PDF-файле. Но мой код не работает. Показаны эти ошибки:
1 и 2
какое может быть решение?
Вот код

Код: Выделить всё

# include "iGraphics.h"

int x = 300, y = 300, r = 20;
/*
function iDraw() is called again and again by the system.

*/

void iDraw() {
//place your drawing codes here
iClear();
iSetColor(20, 200, 200);
iFilledCircle(x, y, r);
//iFilledRectangle(10, 30, 20, 20);
iSetColor(20, 200, 0);
iText(40, 40, "Hi, I am iGraphics");
}

/*
function iMouseMove() is called when the user presses and drags the mouse.
(mx, my) is the position where the mouse pointer is.
*/
void iMouseMove(int mx, int my) {
printf("x = %d, y= %d\n",mx,my);
//place your codes here
}

/*
function iMouse() is called when the user presses/releases the mouse.
(mx, my) is the position where the mouse pointer is.
*/
void iMouse(int button, int state, int mx, int my) {
if (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN) {
//place your codes here
//  printf("x = %d, y= %d\n",mx,my);
x += 10;
y += 10;
}
if (button == GLUT_RIGHT_BUTTON && state == GLUT_DOWN) {
//place your codes here
x -= 10;
y -= 10;
}
}

/*
function iKeyboard() is called whenever the user hits a key in keyboard.
key- holds the ASCII value of the key pressed.
*/
void iKeyboard(unsigned char key) {
if (key == 'q') {
exit(0);
}
//place your codes for other keys here
}

/*
function iSpecialKeyboard() is called whenver user hits special keys like-
function keys, home, end, pg up, pg down, arraows etc. you have to use
appropriate constants to detect them. A list is:
GLUT_KEY_F1, GLUT_KEY_F2, GLUT_KEY_F3, GLUT_KEY_F4, GLUT_KEY_F5, GLUT_KEY_F6,
GLUT_KEY_F7, GLUT_KEY_F8, GLUT_KEY_F9, GLUT_KEY_F10, GLUT_KEY_F11, GLUT_KEY_F12,
GLUT_KEY_LEFT, GLUT_KEY_UP, GLUT_KEY_RIGHT, GLUT_KEY_DOWN, GLUT_KEY_PAGE UP,
GLUT_KEY_PAGE DOWN, GLUT_KEY_HOME, GLUT_KEY_END, GLUT_KEY_INSERT
*/
void iSpecialKeyboard(unsigned char key) {

if (key == GLUT_KEY_END) {
exit(0);
}
//place your codes for other keys here
}

int main() {
//place your own initialization codes here.
iInitialize(400, 400, "demo");
return 0;
}
Я настраиваю рабочее пространство перед изучением языка. Подобных вопросов много, но я не понимаю ответов, так как не знаю языка.

Подробнее здесь: https://stackoverflow.com/questions/790 ... nt-to-char

Вернуться в «C++»