bom, mudei o texto pq o axo q o problema eh outro..nao tao facil d resolver (pra mim pelo menos)
to tentando compilar o simples programa abaixo
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char** argv) {
string name;
if (argc > 1) name = argv[1];
else cin >> name;
cout << "Hello, " + name;
return 0;
}
mas aparece o seguinte
bruno@ubuntu:~$ gcc teste.h -o teste
teste.h:1:20: error: iostream: Arquivo ou diretório não encontrado
teste.h:2:18: error: string: Arquivo ou diretório não encontrado
teste.h:3: error: syntax error before ‘namespace’
teste.h:3: warning: data definition has no type or storage class
teste.h: In function ‘main’:
teste.h:6: error: ‘string’ undeclared (first use in this function)
teste.h:6: error: (Each undeclared identifier is reported only once
teste.h:6: error: for each function it appears in.)
teste.h:6: error: syntax error before ‘name’
teste.h:7: error: ‘name’ undeclared (first use in this function)
teste.h:8: error: ‘cin’ undeclared (first use in this function)
teste.h:9: error: ‘cout’ undeclared (first use in this function)
mas tanto iostream e string existem e estao no lugar correto..
bruno@ubuntu:~$ locate iostream
/usr/share/info/iostream-2.95.info.gz
/usr/include/c++/4.0.2/backward/iostream.h
/usr/include/c++/4.0.2/iostream
/usr/include/g++-3/iostream.h
/usr/include/g++-3/stdiostream.h
/usr/include/g++-3/iostream
o programa q eu realmente eu quero compilar precisa d outros includes e também recebo a mesma msg, mas a pasta com includes do gcc-4.0 esta completa..
bruno@ubuntu:/usr/include/c++/4.0.2$ ls
algorithm complex debug istream sstream
backward csetjmp deque iterator stack
bits csignal exception limits stdexcept
bitset cstdarg exception_defines.h list streambuf
cassert cstddef ext locale string
cctype cstdio fstream map tr1
cerrno cstdlib functional memory typeinfo
cfloat cstring i486-linux-gnu new utility
ciso646 ctime iomanip numeric valarray
climits cwchar ios ostream vector
clocale cwctype iosfwd queue x86_64-linux-gnu
cmath cxxabi.h iostream set
o gcc esta com a pasta include certa
bruno@ubuntu:~$ gcc -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr --with-gxx-include-dir=/usr/include/c++/4.0.2 --enable-shared --with-system-zlib --libexecdir=/usr/lib --enable-nls --without-included-gettext --enable-threads=posix --program-suffix=-4.0 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr --disable-werror --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9)
a minha pergunta:
por que ele nao esta encontrando os arquivos de include? (alguma dica? falta biblioteca? qual?)
vlw ae