Also ich bin ziemlich neu in C++, und ich habe dieses Programm in Codeblöcke geschrieben:C++: mehrere Definition von `mainCRTStartup‘ Fehler etc
#include<iostream>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}
, wenn ich es ein Lauf es bauen, erhalte ich eine Error. Hier ist das Build-Protokoll:
-------------- Build: Debug in HelloWorld (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -o bin\Debug\CPP_1.exe obj\Debug\main.o
obj\Debug\main.o:crt1.c:(.text+0x280): multiple definition of `mainCRTStartup'
c:/programfiles(x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../crt2.o:crt1.c:(.text+0x280): first defined here
obj\Debug\main.o:crt1.c:(.text+0x2a0): multiple definition of `WinMainCRTStartup'
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../crt2.o:crt1.c:(.text+0x2a0): first defined here
obj\Debug\main.o:crt1.c:(.text+0x2c0): multiple definition of `atexit'
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../crt2.o:crt1.c:(.text+0x2c0): first defined here
obj\Debug\main.o:crt1.c:(.text+0x2d0): multiple definition of `_onexit'
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../crt2.o:crt1.c:(.text+0x2d0): first defined here
obj\Debug\main.o:cygming-crtbegin.c:(.text+0x2e0): multiple definition of `__gcc_register_frame'
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/crtbegin.o:cygming-crtbegin.c:(.text+0x0): first defined here
obj\Debug\main.o:cygming-crtbegin.c:(.text+0x32c): multiple definition of `__gcc_deregister_frame'
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/crtbegin.o:cygming-crtbegin.c:(.text+0x4c): first defined here
obj\Debug\main.o:crt1.c:(.bss+0x4): multiple definition of `_argc'
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../crt2.o:crt1.c:(.bss+0x4):first defined here
obj\Debug\main.o:crt1.c:(.bss+0x0): multiple definition of `_argv'
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../crt2.o:crt1.c:(.bss+0x0): first defined here
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/crtbegin.o:cygming-crtbegin.c:(.text+0x45): undefined reference to `_Jv_RegisterClasses'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 1 second(s))
13 error(s), 0 warning(s) (0 minute(s), 1 second(s))
Ich kann einfach nicht herausfinden, warum es nicht funktioniert. Wenn mir jemand helfen könnte, wäre ich sehr dankbar.
Möglicherweise verwenden Sie eine c-Datei nicht eine cpp-Datei – Conduit
Was ist die Befehlszeile, die Sie zum Kompilieren verwendet haben? – user93353
es hat eine .cpp-Erweiterung und ich habe CodeBlocks zu kompilieren –