I am attempting to recompile a C program i programmed on linux. These are the errors i recieve:
c:\users\dsu\dropbox\codes\c\gamereedtucker\main.c(28): error C2275: 'FILE' : illegal use of this type as an expression
c:\program files\microsoft visual studio 10.0\vc\include\stdio.h(66) : see declaration of 'FILE'
c:\users\dsu\dropbox\codes\c\gamereedtucker\main.c(28): error C2065: 'sy' : undeclared identifier
c:\users\dsu\dropbox\codes\c\gamereedtucker\main.c(29): error C2065: 'sy' : undeclared identifier
c:\users\dsu\dropbox\codes\c\gamereedtucker\main.c(29): warning C4047: '=' : 'int' differs in levels of indirection from 'FILE *'
c:\users\dsu\dropbox\codes\c\gamereedtucker\main.c(48): error C2065: 'sy' : undeclared identifier
c:\users\dsu\dropbox\codes\c\gamereedtucker\main.c(48): warning C4047: 'function' : 'FILE *' differs in levels of indirection from 'int'
c:\users\dsu\dropbox\codes\c\gamereedtucker\main.c(48): warning C4024: 'fprintf' : different types for formal and actual parameter 1
c:\users\dsu\dropbox\codes\c\gamereedtucker\main.c(50): error C2065: 'sy' : undeclared identifier
c:\users\dsu\dropbox\codes\c\gamereedtucker\main.c(50): warning C4047: 'function' : 'FILE *' differs in levels of indirection from 'int'
c:\users\dsu\dropbox\codes\c\gamereedtucker\main.c(50): warning C4024: 'RoomOne' : different types for formal and actual parameter 3
c:\users\dsu\dropbox\codes\c\gamereedtucker\main.c(55): error C2065: 'sy' : undeclared identifier
c:\users\dsu\dropbox\codes\c\gamereedtucker\main.c(55): warning C4047: 'function' : 'FILE *' differs in levels of indirection from 'int'
c:\users\dsu\dropbox\codes\c\gamereedtucker\main.c(55): warning C4024: 'fprintf' : different types for formal and actual parameter 1
c:\users\dsu\dropbox\codes\c\gamereedtucker\main.c(64): error C2065: 'sy' : undeclared identifier
c:\users\dsu\dropbox\codes\c\gamereedtucker\main.c(64): warning C4047: 'function' : 'FILE *' differs in levels of indirection from 'int'
c:\users\dsu\dropbox\codes\c\gamereedtucker\main.c(64): warning C4024: 'fprintf' : different types for formal and actual parameter 1
c:\users\dsu\dropbox\codes\c\gamereedtucker\main.c(67): error C2065: 'sy' : undeclared identifier
c:\users\dsu\dropbox\codes\c\gamereedtucker\main.c(67): warning C4047: 'function' : 'FILE *' differs in levels of indirection from 'int'
c:\users\dsu\dropbox\codes\c\gamereedtucker\main.c(67): warning C4024: 'fclose' : different types for formal and actual parameter 1
commands.c
c:\users\dsu\dropbox\codes\c\gamereedtucker\commands.c(13): warning C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
c:\program files\microsoft visual studio 10.0\vc\include\stdio.h(304) : see declaration of 'scanf'
c:\users\dsu\dropbox\codes\c\gamereedtucker\commands.c(26): warning C4047: 'function' : 'FILE **' differs in levels of >indirection from 'char [10]'
c:\users\dsu\dropbox\codes\c\gamereedtucker\commands.c(26): warning C4024: 'fopen_s' : different types for formal and actual parameter 1
c:\users\dsu\dropbox\codes\c\gamereedtucker\commands.c(26): error C2198: 'fopen_s' : too few arguments for call
c:\users\dsu\dropbox\codes\c\gamereedtucker\commands.c(26): warning C4047: '=' : 'FILE *' differs in levels of indirection from 'errno_t'
c:\users\dsu\dropbox\codes\c\gamereedtucker\commands.c(27): error C2143: syntax error : missing ';' before 'type'
c:\users\dsu\dropbox\codes\c\gamereedtucker\commands.c(28): error C2065: 'done' : undeclared identifier
c:\users\dsu\dropbox\codes\c\gamereedtucker\commands.c(33): error C2143: syntax error : missing ';' before 'type'
c:\users\dsu\dropbox\codes\c\gamereedtucker\commands.c(34): error C2065: 'end' : undeclared identifier
c:\users\dsu\dropbox\codes\c\gamereedtucker\commands.c(36): error C2065: 'done' : undeclared identifier
I did all the errors i could fix already. this is the main.c page from my code, if you want commands.c I can add that aswell.
I would really just like this part of my code to compile so i can fix the rest
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "player.h"
#include "other.h"
int main(int argc, char const *argv[])
{
dug * one = malloc(sizeof(dug)*1);
player * us = malloc (sizeof(player)*1);
us->cheat = malloc(sizeof(int)*1);
*us->cheat = 0;
/*if(argv[1] != NULL);
{
int cheat =0;
FILE * CHEAT;
CHEAT = fopen_s(argv[1], "r");
fscanf(CHEAT,"%d",&cheat);
if(cheat == 25)
{
printf("you activated cheat codes\n");
*us->cheat = 1;
}
fclose(CHEAT);
}*/
FILE *sy;
sy = fopen("story.txt","a");
us -> name = malloc (sizeof(char)*40);
us -> HP = malloc (sizeof(int)*1);
us->dir = malloc(sizeof(int)*1);
us->help = malloc(sizeof(int)*1);
one->torch = malloc(sizeof(int)*1);
*one->torch = 1;
*us->HP = 10;
*us->dir = 3;//1 north, 2 east,3 south,4 west
*us->help = 0;
one->WIN = malloc(sizeof(int)*1);
*one->WIN = 0;
printf(" What is your name:");
scanf("%s", us -> name);
fprintf(sy,"The journals of %s\n", us->name);
RoomOne(us,one,sy);
if(*one->WIN == 0)
{
printf("Game Over,%s\n",us->name);
fprintf(sy,"\tLast entry, %s\n",us->name);
if(*us->cheat == 1)
{
printf("winners never cheat, and cheater's never win.\n");
}
}
if(*one->WIN == 1)
{
printf("You have escaped the dark, Now face the light.\n");
fprintf(sy,"you have won the game, %s.\n",us->name);
}
fclose(sy);
return 0;
}