I am having problems with g++.
I have a simple script:
and I compile it ( g++ Desktop/test.cpp -o run )Code:#include <iostream.h> #include <stdlib.h> using namespace std; int main() { int x = 5; cout << "test" << endl; cout << x << endl; }
I get a error:
and then this error when I run the script ( g++ run )Code:In file included from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/backward/iostream.h:31, from Desktop/test.cpp:1: /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
I did change the iostream.h into iostream and stdlib.h into stdlib, but same thing.Code:In file included from /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/backward/iostream.h:31, from Desktop/test.cpp:1: /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated. [root@localhost ~]# g++ go go: In function `_start': (.text+0x0): multiple definition of `_start' /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o:(.text+0x0): first defined here go:(.rodata+0x0): multiple definition of `_fp_hw' /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o:(.rodata+0x0): first defined here go: In function `_fini': (.fini+0x0): multiple definition of `_fini' /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crti.o:(.fini+0x0): first defined here go:(.rodata+0x4): multiple definition of `_IO_stdin_used' /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o:(.rodata.cst4+0x0): first defined here go: In function `__data_start': (.data+0x0): multiple definition of `__data_start' /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crt1.o:(.data+0x0): first defined here go:(.rodata+0x8): multiple definition of `__dso_handle' /usr/lib/gcc/i386-redhat-linux/4.1.2/crtbegin.o:(.rodata+0x0): first defined here go: In function `_init': (.init+0x0): multiple definition of `_init' /usr/lib/gcc/i386-redhat-linux/4.1.2/../../../crti.o:(.init+0x0): first defined here /usr/lib/gcc/i386-redhat-linux/4.1.2/crtend.o:(.dtors+0x0): multiple definition of `__DTOR_END__' go:(.dtors+0x4): first defined here /usr/bin/ld: warning: Cannot create .eh_frame_hdr section, --eh-frame-hdr ignored. collect2: ld returned 1 exit status
So what is causing all these errors, and how can I fix it ?
I am running Fedora Core 7 on VMware



LinkBack URL
About LinkBacks





CornedBee
...