hello,
ce mercredi 17 juillet 2002, Pascal Perez a �crit:
> je voulais tester GCC pour compiler un prog tout simple en C++ :
> vi ./helloworld.c
> #include <iostream>
>
> init main () {
> std::cout<<"Hello World!\n";
> }
>
> mais : gcc -o ./helloworld.c donne :
> ./helloworld.c:1:20: iostream: No such file or directory
Je n'y connais rien, mais absolument rien mais:
[anne@localhost]# cat helloworld.c
#include <iostream>
int main () {
std::cout<<"Hello World!\n";
}
[anne@localhost]# gcc helloworld.c
helloworld.c:1:20: iostream: No such file or directory
[anne@localhost]# g++ helloworld.c
[anne@localhost]# g++ -o helloworld helloworld.c
[anne@localhost]# ./helloworld
Hello World!
# rpm -qf /usr/bin/g++
gcc-c++-2.96-110
Anne
Plus de d�tails qui m'ont donn� des pistes:
]# gcc -v helloworld.c
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-110)
/usr/lib/gcc-lib/i386-redhat-linux/2.96/cpp0 -lang-c -v -D__GNUC__=2
-D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__
-D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__NO_INLINE__ -Acpu(i386)
-Amachine(i386) -Di386 -D__i386 -D__i386__ -D__tune_i386__ helloworld.c /tmp/ccBLHwLp.i
GNU CPP version 2.96 20000731 (Red Hat Linux 7.3 2.96-110) (cpplib) (i386 Linux/ELF)
ignoring nonexistent directory "/usr/i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/lib/gcc-lib/i386-redhat-linux/2.96/include
/usr/include
End of search list.
helloworld.c:1:20: iostream: No such file or directory
]# g++ -v helloworld.c
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-110)
/usr/lib/gcc-lib/i386-redhat-linux/2.96/cpp0 -lang-c++ -D__GNUG__=2 -D__EXCEPTIONS -v
-D__GNUC__=2 -D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux
-D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__NO_INLINE__
-Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -D__tune_i386__ helloworld.c
/tmp/ccMSIGXO.ii
GNU CPP version 2.96 20000731 (Red Hat Linux 7.3 2.96-110) (cpplib) (i386 Linux/ELF)
ignoring nonexistent directory "/usr/i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/g++-3
/usr/local/include
/usr/lib/gcc-lib/i386-redhat-linux/2.96/include
/usr/include
End of search list.
/usr/lib/gcc-lib/i386-redhat-linux/2.96/cc1plus /tmp/ccMSIGXO.ii -quiet -dumpbase
helloworld.c -version -o /tmp/ccAfd8Rv.s
GNU C++ version 2.96 20000731 (Red Hat Linux 7.3 2.96-110) (i386-redhat-linux)
compiled by GNU C version 2.96 20000731 (Red Hat Linux 7.3 2.96-110).
as -V -Qy -o /tmp/ccUYUEuv.o /tmp/ccAfd8Rv.s
GNU assembler version 2.11.93.0.2 (i386-redhat-linux) using BFD version 2.11.93.0.2
20020207
/usr/lib/gcc-lib/i386-redhat-linux/2.96/collect2 -m elf_i386 -dynamic-linker
/lib/ld-linux.so.2 /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crti.o
/usr/lib/gcc-lib/i386-redhat-linux/2.96/crtbegin.o
-L/usr/lib/gcc-lib/i386-redhat-linux/2.96
-L/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../.. /tmp/ccUYUEuv.o -lstdc++ -lm -lgcc
-lc -lgcc /usr/lib/gcc-lib/i386-redhat-linux/2.96/crtend.o
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crtn.o
--
http://www-internal.alphanet.ch/linux-leman/ avant de poser
une question. Ouais, pour se d�sabonner aussi.