2017-06-26 5 views
0
#include <stdio.h> 

int main() 

{ 

     printf("HelloWorld\n"); 

     return 0; 
} 

Es erschien eine Reihe von Fehlern, wenn ich Build-Schaltfläche geklickt habe. Aber dort ist kein Problem, wenn ich "stdlib.h" für "stdio.h" ersetzte.Stdio.h auf VC++ 6.0

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(84) : error C2059: syntax error : ',' 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(314) : error C2143: syntax error : missing '{' before '__cdecl' 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(314) : error C2143: syntax error : missing ')' before '*' 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(314) : error C2081: 'size_t' : name in formal parameter list illegal 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(314) : error C2081: 'size_t' : name in formal parameter list illegal 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(314) : error C2081: 'FILE' : name in formal parameter list illegal 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(314) : error C2143: syntax error : missing '{' before '*' 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(314) : error C2059: syntax error : ')' 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(314) : error C2059: syntax error : ';' 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(320) : error C2143: syntax error : missing '{' before '__cdecl' 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(320) : error C2143: syntax error : missing ')' before '*' 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(320) : error C2081: 'size_t' : name in formal parameter list illegal 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(320) : error C2081: 'size_t' : name in formal parameter list illegal 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(320) : error C2081: 'FILE' : name in formal parameter list illegal 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(320) : error C2143: syntax error : missing '{' before '*' 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(320) : error C2059: syntax error : ')' 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(320) : error C2059: syntax error : ';' 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(341) : error C2081: 'size_t' : name in formal parameter list illegal 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(342) : error C2059: syntax error : ',' 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(342) : error C2143: syntax error : missing ')' before 'const' 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(342) : error C2081: 'size_t' : name in formal parameter list illegal 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(342) : error C2143: syntax error : missing '{' before 'const' 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(342) : error C2059: syntax error : ',' 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(342) : error C2059: syntax error : ')' 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(352) : error C2059: syntax error : ',' 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(352) : error C2143: syntax error : missing ')' before 'const' 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(352) : error C2081: 'size_t' : name in formal parameter list illegal 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(352) : error C2143: syntax error : missing '{' before 'const' 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(352) : error C2059: syntax error : ',' 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(352) : error C2059: syntax error : ')' 

d:\program files (x86)\vc++ 6.0\vc6.0\vc98\include\stdio.h(403) : fatal error C1003: error count exceeds 100; stopping compilation 
+1

Für Ihre nächste Frage, denken Sie daran, Codeblöcke um 4 Leerzeichen einzurücken (einfach hier wählen Sie den Code und drücken Sie 'ctrl' +' k'). Auch '' ist nützlich für die Ausgabe von Konsolen-Dumps, siehe meine letzte Bearbeitung. Entschuldigen Sie, dass Sie Ihre Änderungen beeinträchtigt haben, das war nicht beabsichtigt. –

+0

Gibt es wirklich einen zwingenden Grund, MSVC6.0 tatsächlich zu verwenden? –

+0

MSVC6.0 wurde in 98 veröffentlicht (wie der Verzeichnisname sagt). Es ist alt genug, um in den meisten Jurisdiktionen zu trinken oder zu wählen. –

Antwort

1

Sie versuchen, C-Code mit einem C++ - Compiler zu kompilieren.

Eine Möglichkeit, um dies mit Visual Studio 6.0 zu umgehen, besteht darin, die Quelldatei so umzubenennen, dass sie eine .c anstelle einer .cpp Erweiterung verwendet. Das versetzt den Compiler in eine Art "C" -Modus.

+2

Ich habe Visual C++ 6 seit Jahren nicht mehr verwendet, aber soweit ich mich erinnere, sollte dies kein Header sein. Im Moment würde ich vermuten, dass ein Präprozessor definiert, um die Syntax der Header-Datei zu vermasseln. – Mario

+0

@Mario: Ich kann dies auch nicht überprüfen, das ist alles aus dem Speicher, aber es ist, was ich getan habe, um diesen Compiler C-Code zu erstellen. – Bathsheba

+0

Soweit ich mich erinnere, haben alle gebündelten Standard-Header richtige optionale '#externe" C "' Klammern um sie herum. Auch wenn es sich um einen C/C++ - Konflikt handeln würde, würde es eher einen Verknüpfungsfehler als eine Syntax zeigen. – Mario

Verwandte Themen