Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: I can't compile in Dev C++

  1. #1
    Newbie Newbie
    Join Date
    Mar 2018
    Posts
    1

    I can't compile in Dev C++

    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

    Code cpp:
    #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_SHARE_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

    Code :
    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"
    Last edited by Dark Photon; 03-07-2018 at 05:35 AM.

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    4,394
    This post has nothing to do with OpenGL. Please read: The Forum Posting Guidelines. See #4 under "Before You Post".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •