Я получаю ошибку, которая действительно расстраивает меня в моей программе на Си.
ошибка:
main.c(65): error C2371: 'extractVals' : redefinition; different basic types
Предполагается, что directClass принимает ссылку на символ, в частности строку 20 (в случае переключателя 'g'), используя переменную s. Я не уверен, что они не одного и того же базового типа, но я не очень хорошо разбираюсь в C, поэтому я не очень хорошо выявляю все проблемы. Любая помощь будет великолепна.
#include <gl\glew.h>
#include <gl\freeglut.h>
#include <gl\GLU.h>
#include <stdio.h>
void directFile(char input[100]){
char switchVal [10] , *s = switchVal;
float val1, val2, val3, val4;
s = strtok(input, " \n\0");
printf("Told str is %s\n", s);
switch(*s){
case '#':
printf("%s is a comment. Has no bearing on application\n", s);
break;
case 'g':
printf("%s is the command to translate an object!\n", s);
extractVals(s);
break;
case 's':
printf("%s is the command to scale, now which one is it?\n",s);
break;
case 'r':
printf("%s will rotate the image!\n",s);
break;
case 'c':
if(strcmp(s , "cone") == 0){
printf("It appears you have your self a %s\n", s);
} else if (strcmp(s , "cube") == 0){
printf("%s is cool too\n" , s);
} else if (*s == 'c'){
printf("Welp command was \"%s\", lets change some colors huh?\n",s);
}
break;
case 't':
break;
case 'o':
break;
case 'f':
break;
case 'm':
break;
}
}
void extractVals(char *input){
while(input != NULL){
printf("%s\n", input);
input = strtok(NULL, " ,");
}
}
void makeLower(char *input)
{
while (*input != '\0')
{
*input = tolower(*input);
input++;
}
}
int main(int argc, char *argv[]) {
FILE *file = fopen(argv[1], "r");
char linebyline [50], *lineStr = linebyline;
char test;
glutInit(&argc, argv);
while(!feof(file) && file != NULL){
fgets(lineStr , 50, file);
makeLower(lineStr);
printf("%s",lineStr);
directFile(lineStr);
}
fclose(file);
glutMainLoop();
}