Why I'm getting these errors?

I executed my project and Visual Studio showed 20-ish syntax errors from stdio.h and string.h

I have not used these libraries. Also, how come they bring up errors? It's not like those library were user-made...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
error C2065: 'endif' : undeclared identifier 
c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdio.h
error C2144: syntax error : 'wchar_t' should be preceded by ')'
c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdio.h
error C2448: '__swprintf_l' : function-style initializer appears to be a function 
definition c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdio.h
error C2062: type 'wchar_t' unexpected	
c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdio.h	
error C2059: syntax error : ')'	
c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdio.h
error C2065: 'endif' : undeclared identifier 
c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdio.h
error C2144: syntax error : 'wchar_t' should be preceded by ')'	  
c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdio.h
error C2448: '__vswprintf_l' : function-style initializer appears to be a function 
definition c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdio.h
error C2062: type 'wchar_t' unexpected	
c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdio.h
error C2059: syntax error : ')'	
c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdio.h	
error C3861: '__vswprintf_l': identifier not found
 c:\program files (x86)\microsoft visual studio 10.0\vc\include\swprintf.inl	
error C3861: '__vswprintf_l': identifier not found
 c:\program files (x86)\microsoft visual studio 10.0\vc\include\swprintf.inl
error C2144: syntax error : 'char' should be preceded by ';' 
c:\program files (x86)\microsoft visual studio 10.0\vc\include\string.h
error C4430: missing type specifier - int assumed. Note: C++ does not support 
default-int c:\program files (x86)\microsoft visual studio 10.0\vc\include\string.h
error C2144: syntax error : 'char' should be preceded by ';' 
c:\program files (x86)\microsoft visual studio 10.0\vc\include\string.h	
error C4430: missing type specifier - int assumed. Note: C++ does not support 
default-int c:\program files (x86)\microsoft visual studio 10.0\vc\include\string.h
error C2086: 'int endif' : redefinition 
c:\program files (x86)\microsoft visual studio 10.0\vc\include\string.h	
error C2144: syntax error : 'char' should be preceded by ';' 
c:\program files (x86)\microsoft visual studio 10.0\vc\include\string.h
error C4430: missing type specifier - int assumed. Note: C++ does not support 
default-int c:\program files (x86)\microsoft visual studio 10.0\vc\include\string.h
error C2086: 'int endif' : redefinition 
c:\program files (x86)\microsoft visual studio 10.0\vc\include\string.h


I'm not using them, I haven't modify them and they are from the compiler, they are supposed to work. What's wrong?
Last edited on
Create a blank new project, add a .cpp file and write this:

1
2
3
4
5
6
7
#include<stdio.h>
#include<string.h>

int main()
{
    return 0;
}

and build it.

Do you still get the same messages? If so you have some messed up project settings I'm guessing.

Any reason you are using <stdio.h>, and not <iostream>, and <string.> rather than <string>?
Last edited on
What does the global space of your code look like? You don't have a macro or a global variable named "endif" do you?

This might also happen if you are trying to use any POSIX headers or libs in your project.

These are considerations for after you run mutexe tests by the way. Most people don't poke around with their global settings though so I don't expect that to be the case.
Topic archived. No new replies allowed.