ALT Linux Community general discussions
 help / color / mirror / Atom feed
* [Comm] Помогите начинающему программисту.
@ 2003-09-22 21:11 mummick
  2003-09-22 21:43 ` Vitaly Lipatov
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: mummick @ 2003-09-22 21:11 UTC (permalink / raw)
  To: community

Hello ,

Недавно решил написать примитивнейший пример из книги

----------01.cpp-----------
#include <iostream.h>
main()
{
      cout << "...\n";
}
----------------------------

Попробовал это дело скомпилировать:
$gcc 01.cpp

На что он мне выдал:

--------------------Вывод:-----------------------------------------------------
In file included from /usr/include/c++/3.2.1/backward/iostream.h:31,
                 from 01.cpp:1:
/usr/include/c++/3.2.1/backward/backward_warning.h:32:2: warning: #warning This
file includes at least one deprecated or antiquated header. Please consider usi
g 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 <
stream> instead of the deprecated header <strstream.h>. To disable this warning
use -Wno-deprecated.
/home/mummick/tmp/cc7KKPIu.o: In function `main':
/home/mummick/tmp/cc7KKPIu.o(.text+0x19): undefined reference to `std::cout'
/home/mummick/tmp/cc7KKPIu.o(.text+0x1e): undefined reference to `std::basic_os
ream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(
td::basic_ostream<char, std::char_traits<char> >&, char const*)'
/home/mummick/tmp/cc7KKPIu.o: In function `__static_initialization_and_destruct
on_0(int, int)':
/home/mummick/tmp/cc7KKPIu.o(.text+0x4a): undefined reference to `std::ios_base
:Init::Init[in-charge]()'
/home/mummick/tmp/cc7KKPIu.o: In function `__tcf_0':
/home/mummick/tmp/cc7KKPIu.o(.text+0x79): undefined reference to `std::ios_base
:Init::~Init [in-charge]()'
/home/mummick/tmp/cc7KKPIu.o(.eh_frame+0x11): undefined reference to `__gxx_per
onality_v0'
collect2: ld returned 1 exit status
---------------------Конец вывода-----------------------

То, что он ругается, что я морально устарел и нехорошо использовать
iostream.h, а вместо этого надо iostream я понял (т.к. в iostream.h
есть #include <iostream> и далее using std::cout;
Но с тем, что делать дальше я глубоко застопорился. Помогите
пожалуйста, подскажите, как в свете новых веяний должен выглядеть
этот исходник. Не дайте погибнуть будущему программисту, растущему во
мне.
  

-- 
Best regards,
 mummick                          mailto:mummick@mail.ru



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Comm] Помогите начинающему программисту.
  2003-09-22 21:11 [Comm] Помогите начинающему программисту mummick
@ 2003-09-22 21:43 ` Vitaly Lipatov
  2003-09-23  4:14 ` Denis S. Filimonov
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Vitaly Lipatov @ 2003-09-22 21:43 UTC (permalink / raw)
  To: community

On Вторник 23 Сентябрь 2003 01:11, mummick wrote:
> Hello ,
>
> Недавно решил написать примитивнейший пример из книги
..
> Но с тем, что делать дальше я глубоко застопорился. Помогите
> пожалуйста, подскажите, как в свете новых веяний должен
> выглядеть этот исходник. Не дайте погибнуть будущему
> программисту, растущему во мне.
либо укажите расширение .cc, либо компилируйте командой g++,
либо ключом командной строки укажите, что у вас программа на C++.

-- 
Lav
Виталий Липатов
Санкт-Петербург
GNU! ALT Linux Team! LaTeX! LyX!


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Comm] Помогите начинающему программисту.
  2003-09-22 21:11 [Comm] Помогите начинающему программисту mummick
  2003-09-22 21:43 ` Vitaly Lipatov
@ 2003-09-23  4:14 ` Denis S. Filimonov
  2003-09-23  5:47 ` Alexey Voinov
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Denis S. Filimonov @ 2003-09-23  4:14 UTC (permalink / raw)
  To: community

On Tuesday 23 September 2003 04:11, mummick wrote:
> Hello ,
>
> Недавно решил написать примитивнейший пример из книги
>
> ----------01.cpp-----------
> #include <iostream.h>
> main()
> {
>       cout << "...\n";
> }
> ----------------------------
>
> Попробовал это дело скомпилировать:
> $gcc 01.cpp
>
либо $ g++ 01.cpp
либо $ gcc 01.cpp -lstdc++

-- 
Sincerely,
Denis.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Comm] Помогите начинающему программисту.
  2003-09-22 21:11 [Comm] Помогите начинающему программисту mummick
  2003-09-22 21:43 ` Vitaly Lipatov
  2003-09-23  4:14 ` Denis S. Filimonov
@ 2003-09-23  5:47 ` Alexey Voinov
  2003-09-23  6:36 ` Roman Savelyev
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alexey Voinov @ 2003-09-23  5:47 UTC (permalink / raw)
  To: community

[-- Attachment #1: Type: text/plain, Size: 556 bytes --]

mummick wrote
> Hello ,
> 
> Недавно решил написать примитивнейший пример из книги
> 
> ----------01.cpp-----------
> #include <iostream.h>
> main()
> {
>       cout << "...\n";
> }
> ----------------------------
Не читайте больше эту книгу.

> 
> Попробовал это дело скомпилировать:
> $gcc 01.cpp
g++

-- 
Best Regards!           | Когда вам платят за работу, надо по крайней мере
Alexey Voinov           | делать вид, что вы работаете...
                        |                         Б.Виан "Осень в Пекине"
voins@voins.program.ru
voins@altlinux.ru


[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Comm] Помогите начинающему программисту.
  2003-09-22 21:11 [Comm] Помогите начинающему программисту mummick
                   ` (2 preceding siblings ...)
  2003-09-23  5:47 ` Alexey Voinov
@ 2003-09-23  6:36 ` Roman Savelyev
  2003-09-23  7:44 ` Andrew Dunets
  2003-09-23 10:17 ` Maksim Otstavnov
  5 siblings, 0 replies; 7+ messages in thread
From: Roman Savelyev @ 2003-09-23  6:36 UTC (permalink / raw)
  To: community

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

mummick пишет:
| Hello ,
|
| Недавно решил написать примитивнейший пример из книги
|
| ----------01.cpp-----------
| #include <iostream.h>
| main()
| {
|       cout << "...\n";
| }
| ----------------------------
|
| Попробовал это дело скомпилировать:
| $gcc 01.cpp
g++ 01.cpp лучше :)

| file includes at least one deprecated or antiquated header.
По новому заголовки STL включаются без .h
Т.е.
- ------------------------
#include <iostream>
int main(void)
~    {
~    cout << "Latest STL are better, then all other :)\n";
~    return 0;
~    }
- -----------------------
g++ -o 01 01.cpp

- --
Rgds!
Roman Savelyev
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE/b+npu08PPWJOeNERAlK+AKDOpKILkB6WMVCZfnErytxYLXkZfgCghI5y
ncOQ8Y10GNXQL9WUHJRWcho=
=W7+M
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Comm] Помогите начинающему программисту.
  2003-09-22 21:11 [Comm] Помогите начинающему программисту mummick
                   ` (3 preceding siblings ...)
  2003-09-23  6:36 ` Roman Savelyev
@ 2003-09-23  7:44 ` Andrew Dunets
  2003-09-23 10:17 ` Maksim Otstavnov
  5 siblings, 0 replies; 7+ messages in thread
From: Andrew Dunets @ 2003-09-23  7:44 UTC (permalink / raw)
  To: community

On Tue, 23 Sep 2003 00:11:28 +0300
mummick <mummick@mail.ru> wrote:

> Hello ,
> 
> Недавно решил написать примитивнейший пример из книги
> 
> ----------01.cpp-----------
> #include <iostream.h>
> main()
> {
>       cout << "...\n";
> }
> ----------------------------

#include <iostream>

using namespace std;

int main () 
{
	cout << "Hello, World!"	<< endl;
	return 0;
}



With the best regards,
Andrew.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Comm] Помогите начинающему программисту.
  2003-09-22 21:11 [Comm] Помогите начинающему программисту mummick
                   ` (4 preceding siblings ...)
  2003-09-23  7:44 ` Andrew Dunets
@ 2003-09-23 10:17 ` Maksim Otstavnov
  5 siblings, 0 replies; 7+ messages in thread
From: Maksim Otstavnov @ 2003-09-23 10:17 UTC (permalink / raw)
  To: community

Tuesday, September 23, 2003, 1:11:28 AM, mummick wrote:
[skip]
m>       cout << "...\n";
[skip]
m> Попробовал это дело скомпилировать:
m> $gcc 01.cpp
[skip]

Вы программу на C++ пытаетесь скомпилировать как программу на C.

Нужно или соответствующий ключик gcc(1) указать, либо воспользоваться
раппером g++(1).


-- 
-- Maksim Otstavnov <maksim@otstavnov.com> http://www.otstavnov.com




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-09-23 10:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-22 21:11 [Comm] Помогите начинающему программисту mummick
2003-09-22 21:43 ` Vitaly Lipatov
2003-09-23  4:14 ` Denis S. Filimonov
2003-09-23  5:47 ` Alexey Voinov
2003-09-23  6:36 ` Roman Savelyev
2003-09-23  7:44 ` Andrew Dunets
2003-09-23 10:17 ` Maksim Otstavnov

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git