openSUSE Forums > Archives > SF Archives > ARCHIVES - Programming & Scripting » Compilation Problem With G++ -- In Opensuse 10.2

Go Back   openSUSE Forums > Archives > SF Archives > ARCHIVES - Programming & Scripting
Forums FAQ Members List Search Today's Posts Mark Forums Read


ARCHIVES - Programming & Scripting A place to discuss website design, programming, shell scripts, etc

 
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-Apr-2008, 08:22
helloc++
Guest
 
Posts: n/a
Default

Hello guys,


Here is the problem i am facing with g++ ,in OpenSuse10.2...
While compiling a small "Helloworld" program i am getting i wanted error messages something like this.......

=> Here is my C++ program
Code:
// file name = helloworld.cpp
****//This is the test program, helloworld****

****#include <iostream>
****using namespace std;

****int main()
****{
********cout << "Hello World!" << endl;
********return 0;
****}
=> After saving the file - helloworld.cpp - ,i have compiled it using the following command in shell prompt ( in Opensuse 10.2 )

Code:
g++ -o**helloworld**helloworld.cpp
=> Now i am getting a huge list of errors , as follows....
Code:
In file included from helloworld.cpp:3:
/usr/include/c++/4.1.2/iostream:43:28: error: bits/c++config.h: No such file or directory
In file included from /usr/include/c++/4.1.2/ios:43,
**************** from /usr/include/c++/4.1.2/ostream:44,
**************** from /usr/include/c++/4.1.2/iostream:44,
**************** from helloworld.cpp:3:
/usr/include/c++/4.1.2/iosfwd:45:29: error: bits/c++locale.h: No such file or directory
/usr/include/c++/4.1.2/iosfwd:46:25: error: bits/c++io.h: No such file or directory
In file included from /usr/include/ctype.h:28,
**************** from /usr/include/c++/4.1.2/cctype:51,
**************** from /usr/include/c++/4.1.2/iosfwd:47,
**************** from /usr/include/c++/4.1.2/ios:43,
**************** from /usr/include/c++/4.1.2/ostream:44,
**************** from /usr/include/c++/4.1.2/iostream:44,
**************** from helloworld.cpp:3:
/usr/include/bits/types.h:31:20: error: stddef.h: No such file or directory
In file included from /usr/include/c++/4.1.2/climits:50,
**************** from /usr/include/c++/4.1.2/bits/stl_algobase.h:66,
**************** from /usr/include/c++/4.1.2/bits/char_traits.h:46,
**************** from /usr/include/c++/4.1.2/ios:45,
**************** from /usr/include/c++/4.1.2/ostream:44,
**************** from /usr/include/c++/4.1.2/iostream:44,
**************** from helloworld.cpp:3:
/usr/include/limits.h:125:26: error: no include path in which to search for limits.h
In file included from /usr/include/stdio.h:72,
**************** from /usr/include/c++/4.1.2/cstdio:53,
**************** from /usr/include/c++/4.1.2/ios:46,
**************** from /usr/include/c++/4.1.2/ostream:44,
**************** from /usr/include/c++/4.1.2/iostream:44,
**************** from helloworld.cpp:3:
/usr/include/libio.h:53:21: error: stdarg.h: No such file or directory
In file included from /usr/include/c++/4.1.2/bits/ios_base.h:45,
**************** from /usr/include/c++/4.1.2/ios:48,
**************** from /usr/include/c++/4.1.2/ostream:44,
**************** from /usr/include/c++/4.1.2/iostream:44,
**************** from helloworld.cpp:3:
/usr/include/c++/4.1.2/bits/atomicity.h:38:30: error: bits/atomic_word.h: No such file or directory
In file included from /usr/include/c++/4.1.2/memory:54,
**************** from /usr/include/c++/4.1.2/string:47,
**************** from /usr/include/c++/4.1.2/bits/locale_classes.h:47,
**************** from /usr/include/c++/4.1.2/bits/ios_base.h:47,
**************** from /usr/include/c++/4.1.2/ios:48,
**************** from /usr/include/c++/4.1.2/ostream:44,
**************** from /usr/include/c++/4.1.2/iostream:44,
**************** from helloworld.cpp:3:
/usr/include/c++/4.1.2/bits/allocator.h:52:31: error: bits/c++allocator.h: No such file or directory
In file included from /usr/include/c++/4.1.2/bits/ios_base.h:47,
**************** from /usr/include/c++/4.1.2/ios:48,
**************** from /usr/include/c++/4.1.2/ostream:44,
**************** from /usr/include/c++/4.1.2/iostream:44,
**************** from helloworld.cpp:3:
/usr/include/c++/4.1.2/bits/locale_classes.h:49:23: error: bits/gthr.h: No such file or directory
In file included from /usr/include/c++/4.1.2/bits/basic_ios.h:44,
**************** from /usr/include/c++/4.1.2/ios:50,
**************** from /usr/include/c++/4.1.2/ostream:44,
**************** from /usr/include/c++/4.1.2/iostream:44,
**************** from helloworld.cpp:3:
/usr/include/c++/4.1.2/bits/locale_facets.h:132:31: error: bits/ctype_base.h: No such file or directory
/usr/include/c++/4.1.2/bits/locale_facets.h:1508:33: error: bits/ctype_inline.h: No such file or directory
/usr/include/c++/4.1.2/bits/locale_facets.h:2995:33: error: bits/time_members.h: No such file or directory
/usr/include/c++/4.1.2/bits/locale_facets.h:4550:37: error: bits/messages_members.h: No such file or directory
/usr/include/c++/4.1.2/cstddef:54: error: ā::ptrdiff_tā has not been declared
/usr/include/c++/4.1.2/cstddef:55: error: ā::size_tā has not been declared
/usr/include/time.h:200: error: āsize_tā does not name a type
/usr/include/time.h:218: error: āsize_tā does not name a type
/usr/include/gconv.h: At global scope:
/usr/include/gconv.h:72: error: āsize_tā has not been declared
=> In my machine g++ is installed properly. when i am typing the command - which g++ - , i am able to see the result as follows...
Code:
/usr/bin/g++
=> In bin folder i am able to see the following after greping ( ll | grep "g++" ).

Code:
lrwxrwxrwx**1 root root**********7 2008-03-11 17:19 c++ -> g++-4.1
****lrwxrwxrwx**1 root root**********7 2008-03-11 17:19 g++ -> g++-4.1
****-rwxr-xr-x**1 root root**** 127412 2006-11-25 06:54 g++-4.1


Please help me to solve this problem. i am so stucked up with this issue ..!!!!
Thanks in advance
  #2 (permalink)  
Old 09-Apr-2008, 08:33
ken_yap
Guest
 
Posts: n/a
Default

Just the compiler is not enough. You are missing the package containing the include files. Search for a libstdc++41-devel package in YaST and install that.
  #3 (permalink)  
Old 09-Apr-2008, 09:11
helloc++
Guest
 
Posts: n/a
Default

Quote:
Just the compiler is not enough. You are missing the package containing the include files. Search for a libstdc++41-devel package in YaST and install that.
[/b]

thank you so much for your reply

but i am not able go ahead as i am not a Linux expert
what i did was....
=> i greped the rpm like as follows ...

Code:
 rpm -qa | grep std
=> then i got the following result
Code:
libstdc++41-devel-4.1.2_20061115-5
libstdc++-devel-4.1.3-29
compat-libstdc++-5.0.7-41
libstdc++41-32bit-4.1.2_20061115-5
ghostscript-fonts-std-8.15.3-26
libstdc++41-4.1.2_20061115-5
libstdc++2.10-2.96-0.83mdk

Unfortunatly i don't know how to "Search for a libstdc++41-devel package in YaST and install that ..."
Can you please guide me ,i am struggling like anything .
  #4 (permalink)  
Old 09-Apr-2008, 09:31
ken_yap
Guest
 
Posts: n/a
Default

http://en.opensuse.org/YaST_Software_Management

But the strange thing is that you do seem to have the packages. Your program compiles file on my system which is 10.3. It should work on 10.2, but that error is puzzling, as those include files should be there, unless the installation was damaged and some files were lost.
  #5 (permalink)  
Old 09-Apr-2008, 17:45
hooper
Guest
 
Posts: n/a
Default

Your code runs fine on my system as well.

Try running ldconfig as root. It doesn't need any options. This should have already been done by rpm but it certainly doesn't hurt to repeat the process. Otherwise try

rpm -V libstdc++41-devel

This should produce no output. If it does then let us know what.

Also take a look in /usr/include/c++/4.1.2/i586-suse-linux/bits/ ("i586" might be i386 or athlon or whatever system you have) and see if the missing files are there. You should have something like this:

Code:
hooper@box:/usr/include/c++/4.2.1/i586-suse-linux/bits> ls -al
total 168
drwxr-xr-x 2 root root**4096 2008-02-18 23:39 .
drwxr-xr-x 3 root root**4096 2008-02-18 23:39 ..
-rw-r--r-- 1 root root**2266 2007-09-21 19:08 atomic_word.h
-rw-r--r-- 1 root root**3014 2007-09-21 19:08 basic_file.h
-rw-r--r-- 1 root root**1788 2007-09-21 19:08 c++allocator.h
-rw-r--r-- 1 root root 38794 2007-09-21 19:08 c++config.h
-rw-r--r-- 1 root root**1915 2007-09-21 19:08 c++io.h
-rw-r--r-- 1 root root**3594 2007-09-21 19:08 c++locale.h
-rw-r--r-- 1 root root**1658 2007-09-21 19:08 cpu_defines.h
-rw-r--r-- 1 root root**2542 2007-09-21 19:08 ctype_base.h
-rw-r--r-- 1 root root**2550 2007-09-21 19:08 ctype_inline.h
-rw-r--r-- 1 root root**5418 2007-09-21 19:08 ctype_noninline.h
-rw-r--r-- 1 root root**2205 2007-09-21 19:08 cxxabi_tweaks.h
-rw-r--r-- 1 root root 17611 2007-09-21 19:08 gthr-default.h
-rw-r--r-- 1 root root**4384 2007-09-21 19:08 gthr.h
-rw-r--r-- 1 root root 17611 2007-09-21 19:08 gthr-posix.h
-rw-r--r-- 1 root root**6022 2007-09-21 19:08 gthr-single.h
-rw-r--r-- 1 root root**5938 2007-09-21 19:08 gthr-tpf.h
-rw-r--r-- 1 root root**4013 2007-09-21 19:08 messages_members.h
-rw-r--r-- 1 root root**2024 2007-09-21 19:08 os_defines.h
-rw-r--r-- 1 root root**3071 2007-09-21 19:08 time_members.h
Hooper.
  #6 (permalink)  
Old 10-Apr-2008, 00:44
helloc++
Guest
 
Posts: n/a
Default

Quote:
Your code runs fine on my system as well.

Try running ldconfig as root. It doesn't need any options. This should have already been done by rpm but it certainly doesn't hurt to repeat the process. Otherwise try

rpm -V libstdc++41-devel

This should produce no output. If it does then let us know what.

Also take a look in /usr/include/c++/4.1.2/i586-suse-linux/bits/ ("i586" might be i386 or athlon or whatever system you have) and see if the missing files are there. You should have something like this:

Code:
hooper@box:/usr/include/c++/4.2.1/i586-suse-linux/bits> ls -al
total 168
drwxr-xr-x 2 root root**4096 2008-02-18 23:39 .
drwxr-xr-x 3 root root**4096 2008-02-18 23:39 ..
-rw-r--r-- 1 root root**2266 2007-09-21 19:08 atomic_word.h
-rw-r--r-- 1 root root**3014 2007-09-21 19:08 basic_file.h
-rw-r--r-- 1 root root**1788 2007-09-21 19:08 c++allocator.h
-rw-r--r-- 1 root root 38794 2007-09-21 19:08 c++config.h
-rw-r--r-- 1 root root**1915 2007-09-21 19:08 c++io.h
-rw-r--r-- 1 root root**3594 2007-09-21 19:08 c++locale.h
-rw-r--r-- 1 root root**1658 2007-09-21 19:08 cpu_defines.h
-rw-r--r-- 1 root root**2542 2007-09-21 19:08 ctype_base.h
-rw-r--r-- 1 root root**2550 2007-09-21 19:08 ctype_inline.h
-rw-r--r-- 1 root root**5418 2007-09-21 19:08 ctype_noninline.h
-rw-r--r-- 1 root root**2205 2007-09-21 19:08 cxxabi_tweaks.h
-rw-r--r-- 1 root root 17611 2007-09-21 19:08 gthr-default.h
-rw-r--r-- 1 root root**4384 2007-09-21 19:08 gthr.h
-rw-r--r-- 1 root root 17611 2007-09-21 19:08 gthr-posix.h
-rw-r--r-- 1 root root**6022 2007-09-21 19:08 gthr-single.h
-rw-r--r-- 1 root root**5938 2007-09-21 19:08 gthr-tpf.h
-rw-r--r-- 1 root root**4013 2007-09-21 19:08 messages_members.h
-rw-r--r-- 1 root root**2024 2007-09-21 19:08 os_defines.h
-rw-r--r-- 1 root root**3071 2007-09-21 19:08 time_members.h
Hooper.
[/b]
i went to ptath "/usr/include/c++/4.1.2/x86_64-suse-linux/bits"
There i can see the list of files
Code:
left:/usr/include/c++/4.1.2/x86_64-suse-linux/bits # ll -a
total 196
drwxr-xr-x 3 root root**4096 2008-03-11 17:19 .
drwxr-xr-x 3 root root**4096 2008-03-11 17:18 ..
-rw-r--r-- 1 root root**2175 2006-11-25 06:24 atomic_word.h
-rw-r--r-- 1 root root**2987 2006-11-25 06:24 basic_file.h
-rw-r--r-- 1 root root**1639 2006-11-25 06:24 c++allocator.h
-rw-r--r-- 1 root root 67810 2006-11-25 06:24 c++config.h
-rw-r--r-- 1 root root**1730 2006-11-25 06:24 c++io.h
-rw-r--r-- 1 root root**3355 2006-11-25 06:24 c++locale.h
-rw-r--r-- 1 root root**1510 2006-11-25 06:24 cpu_defines.h
-rw-r--r-- 1 root root**2487 2006-11-25 06:24 ctype_base.h
-rw-r--r-- 1 root root**2346 2006-11-25 06:24 ctype_inline.h
-rw-r--r-- 1 root root**5266 2006-11-25 06:24 ctype_noninline.h
-rw-r--r-- 1 root root**2108 2006-11-25 06:24 cxxabi_tweaks.h
-rw-r--r-- 1 root root 15585 2006-11-25 06:24 gthr-default.h
-rw-r--r-- 1 root root**4384 2006-11-25 06:24 gthr.h
-rw-r--r-- 1 root root 15585 2006-11-25 06:24 gthr-posix.h
-rw-r--r-- 1 root root**6022 2006-11-25 06:24 gthr-single.h
-rw-r--r-- 1 root root**5232 2006-11-25 06:24 gthr-tpf.h
-rw-r--r-- 1 root root**3805 2006-11-25 06:24 messages_members.h
-rw-r--r-- 1 root root**1877 2006-11-25 06:24 os_defines.h
drwxr-xr-x 2 root root**4096 2008-03-11 17:19 stdc++.h.gch
-rw-r--r-- 1 root root**2867 2006-11-25 06:24 time_members.h
So my conculsion is "all required files are there " ...Then why it is showing compilation error like as follow ......

Code:
In file included from helloworld.cpp:3:
/usr/include/c++/4.1.2/iostream:43:28: error: bits/c++config.h: No such file or directory
In file included from /usr/include/c++/4.1.2/ios:43,
**************** from /usr/include/c++/4.1.2/ostream:44,
**************** from /usr/include/c++/4.1.2/iostream:44,
**************** from helloworld.cpp:3:
/usr/include/c++/4.1.2/iosfwd:45:29: error: bits/c++locale.h: No such file or directory
/usr/include/c++/4.1.2/iosfwd:46:25: error: bits/c++io.h: No such file or directory
In file included from /usr/include/ctype.h:28,
**************** from /usr/include/c++/4.1.2/cctype:51,
**************** from /usr/include/c++/4.1.2/iosfwd:47,
**************** from /usr/include/c++/4.1.2/ios:43,
**************** from /usr/include/c++/4.1.2/ostream:44,
**************** from /usr/include/c++/4.1.2/iostream:44,
**************** from helloworld.cpp:3:
/usr/include/bits/types.h:31:20: error: stddef.h: No such file or directory
In file included from /usr/include/c++/4.1.2/climits:50,
**************** from /usr/include/c++/4.1.2/bits/stl_algobase.h:66,
**************** from /usr/include/c++/4.1.2/bits/char_traits.h:46,
**************** from /usr/include/c++/4.1.2/ios:45,
**************** from /usr/include/c++/4.1.2/ostream:44,
**************** from /usr/include/c++/4.1.2/iostream:44,
**************** from helloworld.cpp:3:
/usr/include/limits.h:125:26: error: no include path in which to search for limits.h
In file included from /usr/include/stdio.h:72,
**************** from /usr/include/c++/4.1.2/cstdio:53,
**************** from /usr/include/c++/4.1.2/ios:46,
**************** from /usr/include/c++/4.1.2/ostream:44,
**************** from /usr/include/c++/4.1.2/iostream:44,
**************** from helloworld.cpp:3:
/usr/include/libio.h:53:21: error: stdarg.h: No such file or directory
In file included from /usr/include/c++/4.1.2/bits/ios_base.h:45,
**************** from /usr/include/c++/4.1.2/ios:48,
**************** from /usr/include/c++/4.1.2/ostream:44,
**************** from /usr/include/c++/4.1.2/iostream:44,
**************** from helloworld.cpp:3:
/usr/include/c++/4.1.2/bits/atomicity.h:38:30: error: bits/atomic_word.h: No such file or directory
In file included from /usr/include/c++/4.1.2/memory:54,
**************** from /usr/include/c++/4.1.2/string:47,
**************** from /usr/include/c++/4.1.2/bits/locale_classes.h:47,
**************** from /usr/include/c++/4.1.2/bits/ios_base.h:47,
**************** from /usr/include/c++/4.1.2/ios:48,
**************** from /usr/include/c++/4.1.2/ostream:44,
**************** from /usr/include/c++/4.1.2/iostream:44,
**************** from helloworld.cpp:3:
/usr/include/c++/4.1.2/bits/allocator.h:52:31: error: bits/c++allocator.h: No such file or directory
In file included from /usr/include/c++/4.1.2/bits/ios_base.h:47,
**************** from /usr/include/c++/4.1.2/ios:48,
**************** from /usr/include/c++/4.1.2/ostream:44,
**************** from /usr/include/c++/4.1.2/iostream:44,
**************** from helloworld.cpp:3:
/usr/include/c++/4.1.2/bits/locale_classes.h:49:23: error: bits/gthr.h: No such file or directory
In file included from /usr/include/c++/4.1.2/bits/basic_ios.h:44,
**************** from /usr/include/c++/4.1.2/ios:50,
**************** from /usr/include/c++/4.1.2/ostream:44,
**************** from /usr/include/c++/4.1.2/iostream:44,
**************** from helloworld.cpp:3:
/usr/include/c++/4.1.2/bits/locale_facets.h:132:31: error: bits/ctype_base.h: No such file or directory
/usr/include/c++/4.1.2/bits/locale_facets.h:1508:33: error: bits/ctype_inline.h: No such file or directory
/usr/include/c++/4.1.2/bits/locale_facets.h:2995:33: error: bits/time_members.h: No such file or directory
/usr/include/c++/4.1.2/bits/locale_facets.h:4550:37: error: bits/messages_members.h: No such file or directory
/usr/include/c++/4.1.2/cstddef:54: error: ā::ptrdiff_tā has not been declared
/usr/include/c++/4.1.2/cstddef:55: error: ā::size_tā has not been declared
/usr/include/time.h:200: error: āsize_tā does not name a type
/usr/include/time.h:218: error: āsize_tā does not name a type
/usr/include/c++/4.1.2/ctime:79: error: ā::strftimeā has not been declared
/usr/include/c++/4.1.2/bits/postypes.h:78: error: āptrdiff_tā does not name a type
/usr/include/string.h:39: error: āsize_tā has not been declared
/usr/include/string.h:43: error: āsize_tā has not been declared

pleaseeeeeeeeee help me ...!!!!!


  #7 (permalink)  
Old 10-Apr-2008, 03:34
hooper
Guest
 
Posts: n/a
Default

Try telling the compiler specifically where the headers are:

g++ -o helloworld helloworld.cpp -I/usr/include/c++/4.1.2/x86_64-suse-linux/bits

I don't think this will solve the problem but it might reduce the number of error messages - and give a clue as to the problem.

Hooper.
  #8 (permalink)  
Old 10-Apr-2008, 04:46
helloc++
Guest
 
Posts: n/a
Default

Quote:
Try telling the compiler specifically where the headers are:

g++ -o helloworld helloworld.cpp -I/usr/include/c++/4.1.2/x86_64-suse-linux/bits

I don't think this will solve the problem but it might reduce the number of error messages - and give a clue as to the problem.

Hooper.
[/b]

Thanks for the mentality to help me..!!
I have tired the command
Code:
g++ -o helloworld helloworld.cpp -I/usr/include/c++/4.1.2/x86_64-suse-linux/bits
But still getting the same error.

Can you tell me other solution , like UNINSTALL g++ and INSTALL g++ successfully. Can tell me the step by step procedure for UNINSTALL + INSTALL g++ ...?

If am doing the reinstallation of g++ , will it solve my isuuess ...?
  #9 (permalink)  
Old 10-Apr-2008, 11:48
hooper
Guest
 
Posts: n/a
Default

Yep, I think you're right - re-installing is the only other thing I can think of doing.

The approved method for Suse is to use Yast. Once you have Yast open (you will need root password) go to Software and then Software Management. Change the Filter combo box to 'Package Groups' - this makes it nice and easy to go through what packages you have installed. Development->Languages would be a good place to start. Everything with a blue tick on the right hand side is installed - to uninstall just click so that the tick disappears. When you have taken out all you want to uninstall click Accept.

If you really want to uninstall packages with RPM you want the -e switch. Yast uses RPM under the hood so the two methods are effectively the same.

On the other hand RPM very rarely messes up so there could well be a deeper problem which uninstalling and re-installing won't fix. It's bound to be something really obscure! Faced with your situation I would rather not try to fix this installation (and all the time-consuming messing about this entails) but download the disks for Suse 10.3, wipe the partition and re-install from scratch instead. This has the added bonus of bringing all the rest of your software up to more recent (and hopefully more bug free) versions.

Hooper.
 

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




 

Search Engine Friendly URLs by vBSEO 3.3.0 RC2