Jump to content

Compile C++ programs error! [solved]


Recommended Posts

I get the following message during trying to compile any of C++ progs:

 

hecking build system type... i686-pc-linux-gnu

checking host system type... i686-pc-linux-gnu

checking target system type... i686-pc-linux-gnu

checking for a BSD-compatible install... /usr/bin/install -c

checking for -p flag to install... yes

checking whether build environment is sane... yes

checking for gawk... gawk

checking whether make sets $(MAKE)... yes

checking for style of include used by make... GNU

checking for gcc... gcc

checking for C compiler default output file name... a.out

checking whether the C compiler works... yes

checking whether we are cross compiling... no

checking for suffix of executables...

checking for suffix of object files... o

checking whether we are using the GNU C compiler... yes

checking whether gcc accepts -g... yes

checking for gcc option to accept ANSI C... none needed

checking dependency style of gcc... gcc3

checking how to run the C preprocessor... gcc -E

checking for g++... g++

checking whether we are using the GNU C++ compiler... yes

checking whether g++ accepts -g... yes

checking dependency style of g++... gcc3

checking whether g++ supports -fno-builtin... no

checking whether g++ supports -Woverloaded-virtual... yes

checking whether g++ supports -Wmissing-format-attribute... yes

checking whether g++ supports -Wundef... yes

checking whether g++ supports -Wno-long-long... yes

checking whether g++ supports -Wnon-virtual-dtor... yes

checking whether g++ supports -fno-exceptions... yes

checking whether g++ supports -fno-check-new... yes

checking whether g++ supports -fno-common... yes

checking whether g++ supports -fexceptions... yes

checking how to run the C++ preprocessor... g++ -E

checking whether g++ supports -O0... yes

checking whether g++ supports -Wl,--no-undefined... yes

checking whether g++ supports -Wl,--allow-shlib-undefined... yes

not using lib directory suffix

checking for a sed that does not truncate output... /bin/sed

checking for egrep... grep -E

checking for ld used by gcc... /usr/bin/ld

checking if the linker (/usr/bin/ld) is GNU ld... yes

checking for /usr/bin/ld option to reload object files... -r

checking for BSD-compatible nm... /usr/bin/nm -B

checking whether ln -s works... yes

checking how to recognise dependent libraries... pass_all

checking for ANSI C header files... yes

checking for sys/types.h... no

checking for sys/stat.h... no

checking for stdlib.h... no

checking for string.h... no

checking for memory.h... no

checking for strings.h... no

checking for inttypes.h... no

checking for stdint.h... no

checking for unistd.h... no

checking dlfcn.h usability... no

checking dlfcn.h presence... yes

configure: WARNING: dlfcn.h: present but cannot be compiled

configure: WARNING: dlfcn.h: check for missing prerequisite headers?

configure: WARNING: dlfcn.h: see the Autoconf documentation

configure: WARNING: dlfcn.h: section "Present But Cannot Be Compiled"

configure: WARNING: dlfcn.h: proceeding with the preprocessor's result

configure: WARNING: dlfcn.h: in the future, the compiler will take precedence

configure: WARNING: ## ------------------------------------------ ##

configure: WARNING: ## Report this to the AC_PACKAGE_NAME lists. ##

configure: WARNING: ## ------------------------------------------ ##

checking for dlfcn.h... yes

checking for g77... no

checking for f77... no

checking for xlf... no

checking for frt... no

checking for pgf77... no

checking for fort77... no

checking for fl32... no

checking for af77... no

checking for f90... no

checking for xlf90... no

checking for pgf90... no

checking for epcf90... no

checking for f95... no

checking for fort... no

checking for xlf95... no

checking for ifc... no

checking for efc... no

checking for pgf95... no

checking for lf95... no

checking for gfortran... no

checking whether we are using the GNU Fortran 77 compiler... no

checking whether accepts -g... no

checking the maximum length of command line arguments... 32768

checking command to parse /usr/bin/nm -B output from gcc object... ok

checking for objdir... .libs

checking for ar... ar

checking for ranlib... ranlib

checking for strip... strip

checking if gcc static flag works... yes

checking if gcc supports -fno-rtti -fno-exceptions... no

checking for gcc option to produce PIC... -fPIC

checking if gcc PIC flag -fPIC works... yes

checking if gcc supports -c -o file.o... yes

checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes

checking whether -lc should be explicitly linked in... no

checking dynamic linker characteristics... GNU/Linux ld.so

checking how to hardcode library paths into programs... immediate

checking whether stripping libraries is possible... yes

checking for shl_load... no

checking for shl_load in -ldld... no

checking for dlopen... no

checking for dlopen in -ldl... yes

checking whether a program can dlopen itself... no

checking if libtool supports shared libraries... yes

checking whether to build shared libraries... yes

checking whether to build static libraries... no

configure: creating libtool

appending configuration tag "CXX" to libtool

checking for ld used by g++... /usr/bin/ld

checking if the linker (/usr/bin/ld) is GNU ld... yes

checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes

checking for g++ option to produce PIC... -fPIC

checking if g++ PIC flag -fPIC works... yes

checking if g++ supports -c -o file.o... yes

checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes

checking dynamic linker characteristics... GNU/Linux ld.so

checking how to hardcode library paths into programs... immediate

checking whether stripping libraries is possible... yes

checking for shl_load... (cached) no

checking for shl_load in -ldld... (cached) no

checking for dlopen... (cached) no

checking for dlopen in -ldl... (cached) yes

checking whether a program can dlopen itself... (cached) no

appending configuration tag "F77" to libtool

checking for msgfmt... /usr/bin/msgfmt

checking for gmsgfmt... /usr/bin/msgfmt

checking for xgettext... /usr/bin/xgettext

checking if C++ programs can be compiled... no

configure: error: Your Installation isn't able to compile simple C++ programs.

Check config.log for details - if you're using a Linux distribution you might miss

a package named similiar to libstd++-dev.

 

 

I would like to add that the following libs are installed:

libstdc++2.10

libstdc++2.10-devel

libstdc++5

libstdc++5-devel

libstdc++5-static-devel

libstdc++6

libstdc++6-devel

libstdc++6-static-devel

 

System Mandriva 2005

gcc version 3.4.3 (Mandrakelinux 10.2 3.4.3-7mdk)

 

Any clues ????

Link to comment
Share on other sites

Ok. Here we're with the ./configure output:

 

[neo@Zion test_hello]$ ./configure

checking for a BSD-compatible install... /usr/bin/install -c

checking whether build environment is sane... yes

checking for gawk... gawk

checking whether make sets $(MAKE)... yes

checking for g++... g++

checking for C++ compiler default output file name... a.out

checking whether the C++ compiler works... yes

checking whether we are cross compiling... no

checking for suffix of executables...

checking for suffix of object files... o

checking whether we are using the GNU C++ compiler... yes

checking whether g++ accepts -g... yes

checking for style of include used by make... GNU

checking dependency style of g++... gcc3

checking build system type... i686-pc-linux-gnu

checking host system type... i686-pc-linux-gnu

checking for gcc... gcc

checking whether we are using the GNU C compiler... yes

checking whether gcc accepts -g... yes

checking for gcc option to accept ANSI C... none needed

checking dependency style of gcc... gcc3

checking for a sed that does not truncate output... /bin/sed

checking for egrep... grep -E

checking for ld used by gcc... /usr/bin/ld

checking if the linker (/usr/bin/ld) is GNU ld... yes

checking for /usr/bin/ld option to reload object files... -r

checking for BSD-compatible nm... /usr/bin/nm -B

checking whether ln -s works... yes

checking how to recognise dependent libraries... pass_all

checking how to run the C preprocessor... gcc -E

checking for ANSI C header files... yes

checking for sys/types.h... no

checking for sys/stat.h... no

checking for stdlib.h... no

checking for string.h... no

checking for memory.h... no

checking for strings.h... no

checking for inttypes.h... no

checking for stdint.h... no

checking for unistd.h... no

checking dlfcn.h usability... no

checking dlfcn.h presence... yes

configure: WARNING: dlfcn.h: present but cannot be compiled

configure: WARNING: dlfcn.h:    check for missing prerequisite headers?

configure: WARNING: dlfcn.h: see the Autoconf documentation

configure: WARNING: dlfcn.h:    section "Present But Cannot Be Compiled"

configure: WARNING: dlfcn.h: proceeding with the preprocessor's result

configure: WARNING: dlfcn.h: in the future, the compiler will take precedence

configure: WARNING:    ## ------------------------------------------ ##

configure: WARNING:    ## Report this to the AC_PACKAGE_NAME lists.  ##

configure: WARNING:    ## ------------------------------------------ ##

checking for dlfcn.h... yes

checking how to run the C++ preprocessor... g++ -E

checking for g77... g77

checking whether we are using the GNU Fortran 77 compiler... yes

checking whether g77 accepts -g... yes

checking the maximum length of command line arguments... 32768

checking command to parse /usr/bin/nm -B output from gcc object... ok

checking for objdir... .libs

checking for ar... ar

checking for ranlib... ranlib

checking for strip... strip

checking if gcc static flag  works... yes

checking if gcc supports -fno-rtti -fno-exceptions... no

checking for gcc option to produce PIC... -fPIC

checking if gcc PIC flag -fPIC works... yes

checking if gcc supports -c -o file.o... yes

checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes

checking whether -lc should be explicitly linked in... no

checking dynamic linker characteristics... GNU/Linux ld.so

checking how to hardcode library paths into programs... immediate

checking whether stripping libraries is possible... yes

checking if libtool supports shared libraries... yes

checking whether to build shared libraries... yes

checking whether to build static libraries... yes

configure: creating libtool

appending configuration tag "CXX" to libtool

checking for ld used by g++... /usr/bin/ld

checking if the linker (/usr/bin/ld) is GNU ld... yes

checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes

checking for g++ option to produce PIC... -fPIC

checking if g++ PIC flag -fPIC works... yes

checking if g++ supports -c -o file.o... yes

checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes

checking dynamic linker characteristics... GNU/Linux ld.so

checking how to hardcode library paths into programs... immediate

checking whether stripping libraries is possible... yes

appending configuration tag "F77" to libtool

checking if libtool supports shared libraries... yes

checking whether to build shared libraries... yes

checking whether to build static libraries... yes

checking for g77 option to produce PIC... -fPIC

checking if g77 PIC flag -fPIC works... yes

checking if g77 supports -c -o file.o... yes

checking whether the g77 linker (/usr/bin/ld) supports shared libraries... yes

checking dynamic linker characteristics... GNU/Linux ld.so

checking how to hardcode library paths into programs... immediate

checking whether stripping libraries is possible... yes

configure: creating ./config.status

config.status: creating Makefile

config.status: creating src/Makefile

config.status: creating config.h

config.status: config.h is unchanged

config.status: executing depfiles commands

 

Is these warnings important ?:

 

configure: WARNING: dlfcn.h: present but cannot be compiled

configure: WARNING: dlfcn.h:    check for missing prerequisite headers?

configure: WARNING: dlfcn.h: see the Autoconf documentation

configure: WARNING: dlfcn.h:    section "Present But Cannot Be Compiled"

configure: WARNING: dlfcn.h: proceeding with the preprocessor's result

configure: WARNING: dlfcn.h: in the future, the compiler will take precedence

configure: WARNING:    ## ------------------------------------------ ##

configure: WARNING:    ## Report this to the AC_PACKAGE_NAME lists.  ##

configure: WARNING:    ## ------------------------------------------ ##

 

And here is the output after make

make  all-recursive

make[1]: Entering directory `/home/neo/test_hello'

Making all in src

make[2]: Entering directory `/home/neo/test_hello/src'

if g++ -DHAVE_CONFIG_H -I. -I. -I..    -g -O2 -MT test_hello.o -MD -MP -MF ".deps/test_hello.Tpo" -c -o test_hello.o test_hello.cpp; \

then mv -f ".deps/test_hello.Tpo" ".deps/test_hello.Po"; else rm -f ".deps/test_hello.Tpo"; exit 1; fi

In file included from /usr/include/stdio.h:72,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/cstdio:52,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/i586-mandrake-linux-gnu/bits/c++locale.h:42,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/iosfwd:46,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/ios:44,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/ostream:45,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/iostream:45,

                from test_hello.cpp:26:

/usr/include/libio.h:296: error: `_G_off_t' does not name a type

/usr/include/libio.h:371: error: `_G_off64_t' has not been declared

/usr/include/libio.h:409: error: `_G_wint_t' does not name a type

/usr/include/libio.h:410: error: `_G_wint_t' does not name a type

/usr/include/libio.h:411: error: `_G_wint_t' does not name a type

/usr/include/libio.h:475: error: `_G_va_list' has not been declared

/usr/include/libio.h:477: error: `_G_va_list' has not been declared

/usr/include/libio.h:478: error: `_G_ssize_t' does not name a type

/usr/include/libio.h:479: error: `_G_size_t' does not name a type

/usr/include/libio.h:481: error: `_G_off64_t' does not name a type

/usr/include/libio.h:482: error: `_G_off64_t' does not name a type

In file included from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/cstdio:52,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/i586-mandrake-linux-gnu/bits/c++locale.h:42,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/iosfwd:46,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/ios:44,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/ostream:45,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/iostream:45,

                from test_hello.cpp:26:

/usr/include/stdio.h:77: error: `_G_va_list' does not name a type

/usr/include/stdio.h:88: error: `_G_fpos_t' does not name a type

/usr/include/stdio.h:94: error: `_G_fpos64_t' does not name a type

In file included from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/cstdio:52,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/i586-mandrake-linux-gnu/bits/c++locale.h:42,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/iosfwd:46,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/ios:44,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/ostream:45,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/iostream:45,

                from test_hello.cpp:26:

/usr/include/stdio.h:337: error: `_G_va_list' has not been declared

/usr/include/stdio.h:342: error: `_G_va_list' has not been declared

/usr/include/stdio.h:345: error: `_G_va_list' has not been declared

/usr/include/stdio.h:356: error: `_G_va_list' has not been declared

/usr/include/stdio.h:365: error: `_G_va_list' has not been declared

/usr/include/stdio.h:381: error: `_G_va_list' has not been declared

/usr/include/stdio.h:412: error: `_G_va_list' has not been declared

/usr/include/stdio.h:419: error: `_G_va_list' has not been declared

/usr/include/stdio.h:424: error: `_G_va_list' has not been declared

/usr/include/stdio.h:559: error: `_G_ssize_t' does not name a type

/usr/include/stdio.h:562: error: `_G_ssize_t' does not name a type

/usr/include/stdio.h:572: error: `_G_ssize_t' does not name a type

/usr/include/stdio.h:692: error: `fpos_t' has not been declared

/usr/include/stdio.h:697: error: expected `,' or `...' before '*' token

/usr/include/stdio.h:714: error: `fpos64_t' has not been declared

/usr/include/stdio.h:715: error: expected `,' or `...' before '*' token

In file included from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/cstdio:52,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/i586-mandrake-linux-gnu/bits/c++locale.h:42,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/iosfwd:46,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/ios:44,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/ostream:45,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/iostream:45,

                from test_hello.cpp:26:

/usr/include/stdio.h:798: error: `_G_va_list' has not been declared

In file included from /usr/include/stdio.h:828,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/cstdio:52,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/i586-mandrake-linux-gnu/bits/c++locale.h:42,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/iosfwd:46,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/ios:44,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/ostream:45,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/iostream:45,

                from test_hello.cpp:26:

/usr/include/bits/stdio.h:34: error: `_G_va_list' has not been declared

/usr/include/bits/stdio.h:101: error: `_G_ssize_t' does not name a type

In file included from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/i586-mandrake-linux-gnu/bits/c++locale.h:42,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/iosfwd:46,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/ios:44,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/ostream:45,

                from /usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/iostream:45,

                from test_hello.cpp:26:

/usr/lib/gcc/i586-mandrake-linux-gnu/3.4.3/../../../../include/c++/3.4.3/cstdio:100: error: `::fpos_t' has not been declared

make[2]: *** [test_hello.o] Error 1

make[2]: Leaving directory `/home/neo/test_hello/src'

make[1]: *** [all-recursive] Error 1

make[1]: Leaving directory `/home/neo/test_hello'

make: *** [all] Error 2

 

So what now is wrong ??

:help:

Link to comment
Share on other sites

Ok here is main code:

 

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <iostream>
#include <cstdlib>

using namespace std;

int main(int argc, char *argv[])
{
 cout << "Hello, world!" << endl;

 return EXIT_SUCCESS;
}

 

and here is for ex. Line 336 and 337 from usr/include/stdio.h

(the error is /usr/include/stdio.h:337: error: `_G_va_list' has not been declared):

extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
      _G_va_list __arg);

 

sorry this is not telling me anything ....

I attached both files from usr/include/bits/stdio.h and usr/include/stdio.h and

/usr/include/libio.h

Maybe this will help anybody to analyse why ?

_usr_iclude_bits_stdio.h.tar.gz

usr_include_libio.h.tar.gz

_usr_include_stdio.h.tar.gz

Edited by MrMad
Link to comment
Share on other sites

Ok finally solved !!! :cheeky:

 

I started investigation from the warning messages of configure & make.

Most related was the stdio.h and libio.h.

Then I went to RPM drake to take a look in which package these files exist.

I foun one:

 

glibc-deve-l2.3.4-8mdk

 

I went to console and uninstaled this package using urpme (as root) of course.

Together with this package rpme indicated a list of packages that must be uninstaled

too. I save this list in seperate file to use it later.

After uninstaling I paste the list of packages back to urpmi and ..... enter ...waiting,waiting...

complete...

 

I went to my test-hello directory program and issued configure (No Warnings !!!) and

make .... uff ... no warnings no errors .... sucess !!!!

 

:banana::banana::banana:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...