Elem, DevCpp u IDE radi dobro ali u comm.line ne moze da nadje header <iostream>.
Sta nisam radio; pisao sve moguce -I putanje, ali bez uspeha.
iostream.h mi se nalazi u C:\Dev-Cpp\include\c++\backward, pa sam pisao npr:
C:\Dev-Cpp\PROJEKTI>g++ -I"C:\Dev-Cpp\include\c++\backward" -o fajl fajl.cpp , kao i sve ostale inklud putanje do svih .h fajlova, ali kompajler izbacuje:
Code:
fajl.cpp:7:20: iostream: No such file or directory
fajl.cpp: In function 'void a()':
fajl.cpp:14: `cout` undeclared (first use this function)
fajl.cpp:14: (Each undeclared identifier is reported only once for each
fajl.cpp:14: `endl` undeclared (first use this function)
fajl.cpp: In function `int main()`
fajl.cpp:23: `cin` undeclared (first use this function)
fajl.cpp:7:20: iostream: No such file or directory
fajl.cpp: In function 'void a()':
fajl.cpp:14: `cout` undeclared (first use this function)
fajl.cpp:14: (Each undeclared identifier is reported only once for each
fajl.cpp:14: `endl` undeclared (first use this function)
fajl.cpp: In function `int main()`
fajl.cpp:23: `cin` undeclared (first use this function)
Dalje sam primetio, ako umesto <iostream> stavim <iostream.h> dobijem poruku (pored one da je ovakva notacija zastarela):
Code:
In file included from FunctionTable.cpp:7: (linija u kojoj je include<iostream>)
C:/Dev-Cpp/include/c++/backward/iostream.h:34: 'iostream' not declared
C:/Dev-Cpp/include/c++/backward/iostream.h:35: 'ostream' not declared
C:/Dev-Cpp/include/c++/backward/iostream.h:36: 'istream' not declared
...
fajl.cpp: In function 'void a()':
fajl.cpp:14: 'cout' undeclared (first use this function)
fajl.cpp:14: 'endl' undeclared
'cin' undeclared
...
In file included from FunctionTable.cpp:7: (linija u kojoj je include<iostream>)
C:/Dev-Cpp/include/c++/backward/iostream.h:34: 'iostream' not declared
C:/Dev-Cpp/include/c++/backward/iostream.h:35: 'ostream' not declared
C:/Dev-Cpp/include/c++/backward/iostream.h:36: 'istream' not declared
...
fajl.cpp: In function 'void a()':
fajl.cpp:14: 'cout' undeclared (first use this function)
fajl.cpp:14: 'endl' undeclared
'cin' undeclared
...
A ako, npr. ukucam ovako nesto (po lekinoj preporuci):
Code:
c:\Dev-Cpp\Projekti>C:\Dev-Cpp\bin\g++ -I"C:/Dev-Cpp/include/c++" -I"C:/Dev-Cpp/include/c++/mingw32" -I"C:/Dev-Cpp/include/c++/backward" -I"C:/Dev-Cpp/include" -o fajl fajl.cpp
c:\Dev-Cpp\Projekti>C:\Dev-Cpp\bin\g++ -I"C:/Dev-Cpp/include/c++" -I"C:/Dev-Cpp/include/c++/mingw32" -I"C:/Dev-Cpp/include/c++/backward" -I"C:/Dev-Cpp/include" -o fajl fajl.cpp
dobijem izuzetno dugacak spisak gresaka ciji je samo deo:
Code:
In file included from FunctionTable.cpp:7:(u sedmoj liniji je #include<iostream>)
C:/Dev-Cpp/include/c++/iostream:44:28: bits/c++config.h: No such file or dir.
In file included from C:/Dev-Cpp/include/c++/ios:44,
from C:/Dev-Cpp/include/c++/ostream:45,
from C:/Dev-Cpp/include/iostream:45,
from FunctionTable.cpp:7:
C:/Dev-Cpp/include/c++/iosfwd:44:28: bits/c++config.h: No such file or dir.
......
C:/Dev-Cpp/include/c++/bits/fpos.h:60: 'streamoff' is used as a type, but is not defined as a type.
C:/Dev-Cpp/include/c++/bits/fpos.h:74: parse error before '_off'
C:/Dev-Cpp/include/c++/bits/fpos.h:77: missing ';' before right brace itd,itd.
In file included from FunctionTable.cpp:7:(u sedmoj liniji je #include<iostream>)
C:/Dev-Cpp/include/c++/iostream:44:28: bits/c++config.h: No such file or dir.
In file included from C:/Dev-Cpp/include/c++/ios:44,
from C:/Dev-Cpp/include/c++/ostream:45,
from C:/Dev-Cpp/include/iostream:45,
from FunctionTable.cpp:7:
C:/Dev-Cpp/include/c++/iosfwd:44:28: bits/c++config.h: No such file or dir.
......
C:/Dev-Cpp/include/c++/bits/fpos.h:60: 'streamoff' is used as a type, but is not defined as a type.
C:/Dev-Cpp/include/c++/bits/fpos.h:74: parse error before '_off'
C:/Dev-Cpp/include/c++/bits/fpos.h:77: missing ';' before right brace itd,itd.
E sad, meni se cini, po onim gore greskama da kompajler cita pogresne fajlove, npr iostream, umesto iostream.h; jer ga je na to naveo path -I"C:/Dev-Cpp/include/c++. KADA OVAJ PATH IZBRISEM ONE MORSKE PORUKE O GRESKAMA NESTAJU, ali onda ostaje dobra stara poruka da nista od iostream objekata nije definisano.
Stablo dir-a izgleda ovako:
Code:
C:/Dev-Cpp/include/c++,ddk,GL,readline,sys, i razni .h fajlovi
c++/backward, bits, ext, mingw32 i razni prog fajlovi (medju njima i iostream)
backward/.h fajlovi (ostream.h, iostream.h itd)
bits/.h fajlovi
C:/Dev-Cpp/include/c++,ddk,GL,readline,sys, i razni .h fajlovi
c++/backward, bits, ext, mingw32 i razni prog fajlovi (medju njima i iostream)
backward/.h fajlovi (ostream.h, iostream.h itd)
bits/.h fajlovi
Dakle, iostream.h se nalazi u direktorijumu backward. Ja sam to explicitno naznacio sa -I"C:\Dev-Cpp\include\c++\backward", ali bez rezultata.
Ako neko ima ideju molim da je postuje.
Uzgred, da li neko moze da mi razjasni zbrku sa slashovima i backslashovima (kad se sta koristi)?
Tx
(izvinjavam se zbog okeanskog posta)
p.s.
Na guglu sam nasao ovo (samo sto je OS Linux), i dosta slicnih stvari:
Problems with g++ on Linux Slackware 3.0
Citat:
"When I try to compile the traditional Hello, world program on Linux, the compiler can't find `iostream.h'. What's the deal?"
You probably have the Slackware 3.0 release. There's an error in the setup. It's easy to fix, though; log in as root, and make a symbolic link:
You probably have the Slackware 3.0 release. There's an error in the setup. It's easy to fix, though; log in as root, and make a symbolic link:
Code:
ln -s /usr/lib/g++-include /usr/include/g++
ln -s /usr/lib/g++-include /usr/include/g++
ALI:"'ln' is not recognized ..."
Vidim da se ovaj symbolic link cesto pominje kao resenje (gomila ljudi ima isti problem), ali nisam uspeo da ga implementiram.:(