|
Компьютерный форум OSzone.net » Linux и FreeBSD » Программирование в *nix » iostream.h |
|
|
iostream.h
|
Пользователь Сообщения: 96 |
День добрый.
Решил я научиться программировать на С. Скачал книжку "Осовй С++ за 21 день". Замечательная книжка, все понятно, вот только С++-совскую библиотеку мой gcc не знает, в usr/gcclib я ее не нашел. Вопрос: эта библиотека исключительно для вин, я чего-то не доставил или у меня старая версия компилятора? З.Ы. rpm -q gcc gcc-3.3.2-6mdk |
|
------- Отправлено: 15:33, 21-09-2005 |
Линуксоид-стакановец Сообщения: 2391
|
Профиль | Отправить PM | Цитировать |
------- Отправлено: 21:04, 21-09-2005 | #2 |
Для отключения данного рекламного блока вам необходимо зарегистрироваться или войти с учетной записью социальной сети. Если же вы забыли свой пароль на форуме, то воспользуйтесь данной ссылкой для восстановления пароля. |
Пользователь Сообщения: 96
|
Профиль | Отправить PM | Цитировать ocate iostream.h
/usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/include/iostream.h /usr/include/c++/3.3.2/backward/iostream.h /usr/include/c++/3.4.0/backward/iostream.h gcc tt.c tt.c:1:21: iostream.h: No such file or directory tt.c: In function `main': tt.c:7: error: `cout' undeclared (first use in this function) Доставил все касаемо gcc, но результат такой же. Что делать? |
------- Отправлено: 21:43, 21-09-2005 | #3 |
just mar Сообщения: 3904
|
Профиль | Отправить PM | Цитировать Ambal
попробуйте компилировать, используя g++ Пример: $cat hello.cpp #include <iostream.h> main() { cout << "Hello, world\n"; } g++ hello hello.cpp $ls -l -rwxr-xr-x 1 mar wheel 6387 21 сен 22:26 hello -rw-r--r-- 1 mar wheel 69 21 сен 22:25 hello.cpp $./hello Hello, world $ ![]() |
Отправлено: 22:33, 21-09-2005 | #4 |
Линуксоид-стакановец Сообщения: 2391
|
Профиль | Отправить PM | Цитировать Единственное, что пока пришло в голову - неправильные пути gcc к заголовочным файлам. Попробуй их подкорректировать или воспользуйся советом mar
|
|
------- Отправлено: 09:29, 22-09-2005 | #5 |
Пользователь Сообщения: 96
|
Профиль | Отправить PM | Цитировать g++ hello.cpp
In file included from /usr/include/c++/3.3.2/backward/iostream.h:31, from hello.cpp:1: /usr/include/c++/3.3.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 <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated. hello.cpp:12:2: warning: no newline at end of file Не то чтобы я не понимаю английский, но что это значит? Программа не компилируется. |
------- Отправлено: 17:39, 22-09-2005 | #6 |
Старый параноик Сообщения: 2423
|
Профиль | Отправить PM | Цитировать Старая фишка. Не забывайте использовать using namespace std; после #include и помните, что компилятор использует синтаксис с или с++ исходя из расширения файлов с или cpp. ЕМНИП: <iostream.h> используется для С, <iostream> для С++. Эта фишка выплывает раз в месяц у кого-нибудь из наших программеров раз в два месяца точно :]
|
Отправлено: 02:07, 23-09-2005 | #7 |
![]() Старожил Сообщения: 278
|
Профиль | Отправить PM | Цитировать Хм, всегда писал <iostream.h> и никогда таких проблем не было...
|
Отправлено: 10:39, 23-09-2005 | #8 |
Старый параноик Сообщения: 2423
|
Профиль | Отправить PM | Цитировать Дабы не осталось непоняток:
[hasherfrog@********* hasherfrog]$ more 1.cpp #include <iostream> main() { cout << "Hello, world\n"; } [hasherfrog@********* hasherfrog]$ more 1.c #include <iostream.h> main() { cout << "Hello, world\n"; } [hasherfrog@********* hasherfrog]$ more correct.cpp #include <iostream> using namespace std; main() { cout << "Hello, world\n"; } [hasherfrog@********* hasherfrog]$ more with_keys.cpp #include <iostream.h> main() { cout << "Hello, world\n"; } [hasherfrog@********* hasherfrog]$ g++ 1.c In file included from /usr/include/c++/3.2.2/backward/iostream.h:31, from 1.c:1: /usr/include/c++/3.2.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 <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated. [hasherfrog@********* hasherfrog]$ g++ 1.cpp 1.cpp: In function `int main()': 1.cpp:4: `cout' undeclared (first use this function) 1.cpp:4: (Each undeclared identifier is reported only once for each function it appears in.) [hasherfrog@********* hasherfrog]$ gcc 1.cpp 1.cpp: In function `int main()': 1.cpp:4: `cout' undeclared (first use this function) 1.cpp:4: (Each undeclared identifier is reported only once for each function it appears in.) [hasherfrog@********* hasherfrog]$ gcc 1.c 1.c:1:22: iostream.h: No such file or directory 1.c: In function `main': 1.c:3: `cout' undeclared (first use in this function) 1.c:3: (Each undeclared identifier is reported only once 1.c:3: for each function it appears in.) [hasherfrog@********* hasherfrog]$ gcc correct.cpp /tmp/ccrilZvg.o(.text+0x19): In function `main': : undefined reference to `std::cout' /tmp/ccrilZvg.o(.text+0x1e): In function `main': : undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)' /tmp/ccrilZvg.o(.text+0x4a): In function `__static_initialization_and_destruction_0(int, int)': : undefined reference to `std::ios_base::Init::Init[in-charge]()' /tmp/ccrilZvg.o(.text+0x79): In function `__tcf_0': : undefined reference to `std::ios_base::Init::~Init [in-charge]()' /tmp/ccrilZvg.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0' collect2: ld returned 1 exit status [hasherfrog@********* hasherfrog]$ g++ correct.cpp [hasherfrog@********* hasherfrog]$ [hasherfrog@********* hasherfrog]$ g++ 1.c -Wno-deprecated [hasherfrog@********* hasherfrog]$ [hasherfrog@********* hasherfrog]$ g++ with_keys.cpp -Wno-deprecated [hasherfrog@********* hasherfrog]$ |
Отправлено: 12:46, 23-09-2005 | #9 |
![]() Старожил Сообщения: 278
|
Профиль | Отправить PM | Цитировать |
Отправлено: 13:05, 23-09-2005 | #10 |
|
![]() |
Участник сейчас на форуме |
![]() |
Участник вне форума |
![]() |
Автор темы |
![]() |
Сообщение прикреплено |
| |||||
Название темы | Автор | Информация о форуме | Ответов | Последнее сообщение | |
[решено] C++ | Проблема с iostream.h | sasha11 | Программирование и базы данных | 10 | 26-09-2006 08:49 | |
[решено] C/C++ | Особенности #include <iostream.h> | TeTaN | Программирование и базы данных | 5 | 30-07-2006 17:39 |
|