PDA

View Full Version : I can't compile in Dev C++



YahelEs
03-06-2018, 05:37 PM
Well, i did an Application which creates a text file and saves it in an ordinary location, yesterday it was working good, but now when i try to compile in Dev c++ it shows me around five houndred error messages, all related of "windows.h" library, but, if it was working yestarday and i didnt modify my code i don't know what's happening

here is the code


#include<time.h>
#include<stdio.h>
#include<windows.h>
#include<string.h>
int main(int argc, char *argv[])
{

srand(time(NULL));
char dir[100];
strcpy(dir,"C:\\Users\\Hp\\Documents");
char last[10]=".txt";
int i;
char obt[10]="cadenas",num[5];
int numarchivos=rand()%10;
char chains[30][30]={"Hi","Goodbye","Sistems","Operative","Linux","Windows","UNIX","Bye","Seeyou","code"};
HANDLE hFile;
BOOL bFile;
DWORD numberofbytes;
DWORD numberwritten=0;

for(i=0;i<numarchivos;i++){
numberofbytes=strlen(chains[i]);
sprintf(num,"%d",i);
strcat(dir,obt);
strcat(dir,num);
strcat(dir,last);
hFile= CreateFile(dir,GENERIC_READ|GENERIC_WRITE,FILE_SHA RE_READ,NULL,CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL );
if(hFile== INVALID_HANDLE_VALUE){
printf("CreateFile failed\n");}
else printf("CreateFile Success!\n");

bFile= WriteFile(hFile,chains[i],numberofbytes,&numberwritten,NULL);
if(bFile== FALSE){ printf("Write Failed! \n ");
}
printf("Write Success! \n");

CloseHandle(hFile);
strcpy(dir,"C:\\Users\\Hp\\Documents");
}

return 0;
}


Some of the Error messages that the compiler throws are



3 C:\Dev-Cpp\include\windows.h:48, from C:\Users\Hp\Documents\app.c In file included from C:/Dev-Cpp/include/windows.h:48, from C:\Users\Hp\Documents\app.c
3 C:\Users\Hp\Documents\app.c from C:\Users\Hp\Documents\app.c
263 C:\Dev-Cpp\include\windef.h syntax error at '##' token
263 C:\Dev-Cpp\include\windef.h syntax error before '{' token
296 C:\Dev-Cpp\include\windef.h syntax error before "HCURSOR"

Dark Photon
03-07-2018, 06:39 AM
This post has nothing to do with OpenGL. Please read: The Forum Posting Guidelines (https://www.opengl.org/discussion_boards/showthread.php/176139-Forum-Posting-Guidelines?p=1230021&viewfull=1#post1230021). See #4 under "Before You Post".