LINUX.ORG.RU

g++ : проблема с компиляцией «Hello world»


0

0

develop tmp # cat test.cpp 
#include<iostream>

int main()
{
  std::cout << "Hello world" << std::endl;
  return 0;
}
develop tmp # g++ test.cpp 
In file included from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/i686-pc-linux-gnu/bits/o
s_defines.h:39,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/i686-pc-linux-gnu/bits/c
++config.h:35,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/iostream:44,
                 from test.cpp:1:
/usr/include/features.h:309:25: sys/cdefs.h: No such file or directory
In file included from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/clocale:49,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/i686-pc-linux-gnu/bits/c
++locale.h:41,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/iosfwd:46,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/ios:44,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/ostream:45,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/iostream:45,
                 from test.cpp:1:
/usr/include/locale.h:52: error: syntax error before `{' token
/usr/include/locale.h:119: error: syntax error before `}' token
/usr/include/locale.h:125: error: syntax error before `char'
/usr/include/locale.h: In function `lconv* localeconv()':
/usr/include/locale.h:128: error: syntax error before `;' token
In file included from /usr/include/locale.h:146,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/clocale:49,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/i686-pc-linux-gnu/bits/c
++locale.h:41,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/iosfwd:46,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/ios:44,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/ostream:45,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/iostream:45,
                 from test.cpp:1:
/usr/include/xlocale.h:28: error: syntax error before `typedef'
/usr/include/xlocale.h:40: error: syntax error before `}' token
In file included from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/clocale:49,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/i686-pc-linux-gnu/bits/c
++locale.h:41,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/iosfwd:46,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/ios:44,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/ostream:45,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/iostream:45,
                 from test.cpp:1:
/usr/include/locale.h:148: error: syntax error before `;' token
/usr/include/locale.h:154: error: syntax error before `(' token
/usr/include/locale.h:189: error: syntax error before `(' token
/usr/include/locale.h:193: error: `__locale_t' undeclared (first use this 
   function)
/usr/include/locale.h:193: error: (Each undeclared identifier is reported only 
   once for each function it appears in.)
/usr/include/locale.h:193: error: syntax error before `)' token
/usr/include/locale.h: In function `void freelocale(...)':
/usr/include/locale.h:193: error: redefinition of `int __THROW'
/usr/include/locale.h:128: error: `int __THROW' previously declared here
/usr/include/locale.h:200: error: syntax error before `(' token
In file included from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/i686-pc-linux-gnu/bits/c
++locale.h:41,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/iosfwd:46,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/ios:44,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/ostream:45,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/iostream:45,
                 from test.cpp:1:
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/clocale:55: error: syntax
   error before `namespace'
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/clocale:58: error: `
   setlocale' not declared
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/clocale:60: error: syntax
   error before `}' token
In file included from /usr/include/langinfo.h:24,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/i686-pc-linux-gnu/bits/c
++locale.h:42,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/iosfwd:46,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/ios:44,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/ostream:45,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/iostream:45,
                 from test.cpp:1:
/usr/include/nl_types.h:34: error: syntax error before `typedef'
/usr/include/nl_types.h:43: error: syntax error before `(' token
/usr/include/nl_types.h:47: error: `nl_catd' undeclared (first use this 
   function)
/usr/include/nl_types.h:47: error: syntax error before `,' token
/usr/include/nl_types.h: In function `char* catgets(...)':
/usr/include/nl_types.h:48: error: '__THROW' is used as a type, but is not 
   defined as a type.
/usr/include/nl_types.h:51: error: `nl_catd' undeclared (first use this 
   function)
/usr/include/nl_types.h:51: error: syntax error before `)' token
/usr/include/nl_types.h: In function `int catclose(...)':
/usr/include/nl_types.h:51: error: '__THROW' is used as a type, but is not 
   defined as a type.
In file included from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/i686-pc-linux-gnu/bits/c
++locale.h:42,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/iosfwd:46,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/ios:44,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/ostream:45,
                 from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/include/g++-v3/iostream:45,
                 from test.cpp:1:
/usr/include/langinfo.h:43: error: syntax error before `enum'
/usr/include/langinfo.h: In function `char* nl_langinfo(int)':
/usr/include/langinfo.h:576: error: syntax error before `;' token
/usr/include/langinfo.h:576: error: redefinition of `int __THROW'
/usr/include/locale.h:193: error: `int __THROW' previously declared 
...
...
...

develop tmp # g++ --version
g++ (GCC) 3.3.6 (Gentoo Hardened 3.3.6, ssp-3.3.6-1.0, pie-8.7.8)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

develop tmp # 


Any ideas?

Re: g++ : проблема с компиляцией "Hello world"

Что-то ты с версиями намудрил.

Anoxemian ★★★★★ ()

Re: g++ : проблема с компиляцией "Hello world"

Компилятор сломался

Zmacs ()

Re: g++ : проблема с компиляцией "Hello world"

glibc-headers стоят?

mator ★★★★★ ()

Re: g++ : проблема с компиляцией "Hello world"

Ключевая фраза sys/cdefs.h: No such file or directory

>rpm -qf /usr/include/sys/cdefs.h glibc-headers-2.5-12

Судя по всему, отсутствует пакет glibc-header (как уже было указано) или некий аналог, содержащий этот файл.

anonymous ()

Re: g++ : проблема с компиляцией "Hello world"

Друг и товарищ "Krivenok_Dmitry", рождённому жить в вендах и Гента не поможет. Что наглядно доказывает Ваша карма.

Gharik ()
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.