Using certain functions from stdlib.h or stdio.h causes syntax errors

I am working on some C code in Visual Studio 2005 on Win7 Pro x64. The code is correct; it compiles and runs on MinGW under Eclipse. However, the use of certain functions from the standard C libraries, such as stdio or stdlib, leads to the following lines with syntax errors when the code is built on VS2005. As an example:

#include<time.h>
#include<stdlib.h>
#include<stdio.h>
#include"someOtherHeader.h"

int main(void){
    srand((unsigned int) time(NULL));
    double start;
.
.
.

The following code does not matter. VS2005 says that the missing ";" before the "type". Commenting srand () fixes the problem. Oddly enough, when rand () is called later, there are no problems. I also noticed behavior with exit () and fprint (). But not with malloc (). Thoughts?

+3
2

C Visual Studio ( C). :

#include<time.h>
#include<stdlib.h>
#include<stdio.h>
#include"someOtherHeader.h"

int main(void){
    double start;
    srand((unsigned int) time(NULL));
    .
    .
}
+10

Visual Studio NOT C99 ()

0

Source: https://habr.com/ru/post/1758081/


All Articles