Ich habe versucht, C zu lernen, und ich bin dran, einschließlich Bibliotheken. Ich muss Strcpy() verwenden, aber diese Methode ist in der Iostream-Bibliothek enthalten, aber jedes Mal, wenn ich versuche, die Bibliothek einzuschließen, gibt mir das Programm Fehler. Ich habe versucht, mit "iostream", "iostream.h",,, aber es gibt mir entweder ein "kann nicht finden iostream.h" Fehler, oder das Programm überschreitet 100 Fehler und stürzt einfach ab. Auch wenn mein Code leer ist, bekomme ich immer noch das Gleiche. Hier ist der Code:Kann Iostream nicht in C mit MS Visual C++ einschließen?
#include "iostream"
int main(void)
{
}
Yup, nur so viel macht es schon zum Absturz. Und hier ist ein Teil des Fehlers erhalte ich (sie nie alle hier einfügen könnte):
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(37): error C2061: syntax error : identifier 'abs'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(37): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(39): error C2061: syntax error : identifier 'acos'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(39): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(39): error C2061: syntax error : identifier 'asin'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(39): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(40): error C2061: syntax error : identifier 'atan'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(40): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(40): error C2061: syntax error : identifier 'atan2'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(40): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(40): error C2061: syntax error : identifier 'ceil'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(40): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(41): error C2061: syntax error : identifier 'cos'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(41): fatal error C1003: error count exceeds 100; stopping compilation
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Also ja, es übertrifft sogar die 100-Fehler und das Programm gerade nicht mehr zu zählen. Ich verstehe nicht warum, ich schließe nur eine normale Bibliothek ein. Gibt es ein Äquivalent von strcpy()? Ich wollte in erster Linie es so verwenden (für die Praxis):
#include "stdafx.h"
#include "stdlib.h"
#include "stdio.h"
#include "conio.h"
#include "iostream"
int main(void)
{
struct person
{
int id;
char name[50];
int age;
};
struct person p1;
p1.id = 5595;
strcpy(p1.name, "Myname");
p1.age = 18;
printf("%d%s%d", p1.id, p1.name, p1.age);
}
beachten Sie, es gibt einen Unterschied zwischen Absturz und Reporting-Fehler:] ususally Compiler melden Fehler, selten stürzen sie – stijn