LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-14-2005, 10:45 PM   #1
GlassEyeSlim
LQ Newbie
 
Registered: Feb 2005
Location: East Coast
Distribution: FC 3
Posts: 9

Rep: Reputation: 0
g++ troubles


Salutations,

Having siginificant trouble using g++

Problem:

Attempt to compile the following program:

// test.cc

#include <iostream>

using namespace std;

int main()
{

cout << "Hello, world.\n";

return 0;

}

Enter the following at the command line:

[jims@localhost codefiles]$ g++ test.cc

Result, I receive a long cascade of error messages the last few being:

/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/i386-redhat-linux/bits/codecvt_specializations.h:270: error: expected primary-expression before "char"
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/i386-redhat-linux/bits/codecvt_specializations.h:270: error: expected primary-expression before '*' token
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/i386-redhat-linux/bits/codecvt_specializations.h:270: error: `__outbytes' was not declared in this scope
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/i386-redhat-linux/bits/codecvt_specializations.h:271: confused by earlier errors, bailing out

I suspect this is caused by failure to localize the correct lib file.

Thoughts?

GES
 
Old 02-14-2005, 11:05 PM   #2
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
Try doing
$g++ -o test test.cc
 
Old 02-15-2005, 01:10 AM   #3
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
yea i don't say this often but it looks like your compiler is broken
you din't do anything to it like move it's libs or header files around did you ?
where did all that junk come from in /usr/lib/gcc/i386-redhat-linux/3.4.2/includes like that c++ folder.
that's suposed to be in /usr/include
do you have more than one compiler installed ?
 
Old 02-15-2005, 10:13 AM   #4
GlassEyeSlim
LQ Newbie
 
Registered: Feb 2005
Location: East Coast
Distribution: FC 3
Posts: 9

Original Poster
Rep: Reputation: 0
Status

The following RPM packages are installed:

compat-gcc-8-3.3.4.2
compat-gcc-c++-8-3.3.4.2
compat-libstdc++-8-3.3.4.2
compat-libstdc++-devel-8-3.3.4.2
gcc-3.4.2-6.fc3
gcc-c++-3.4.2-6.fc3
libgcc-3.4.2-6.fc3
libstdc++-3.4.2-6.fc3
libstdc++-devel-3.4.2-6.fc3

System is FC3.

Is the solution simply a matter of getting the compiler to look in the proper directory?

GES
 
Old 02-15-2005, 10:32 AM   #5
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Hum. Your code works fine for me.

Compare your output with

[08:28 ~] $ g++ --print-search-dirs
install: /usr/lib/gcc/i386-redhat-linux/3.4.2/
programs: =/usr/libexec/gcc/i386-redhat-linux/3.4.2/:/usr/libexec/gcc/i386-redhat-linux/3.4.2/:/usr/libexec/gcc/i386-redhat-linux/:/usr/lib/gcc/i386-redhat-linux/3.4.2/:/usr/lib/gcc/i386-redhat-linux/:/usr/libexec/gcc/i386-redhat-linux/3.4.2/:/usr/libexec/gcc/i386-redhat-linux/:/usr/lib/gcc/i386-redhat-linux/3.4.2/:/usr/lib/gcc/i386-redhat-linux/:/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../i386-redhat-linux/bin/i386-redhat-linux/3.4.2/:/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../i386-redhat-linux/bin/
libraries: =/usr/lib/gcc/i386-redhat-linux/3.4.2/:/usr/lib/gcc/i386-redhat-linux/3.4.2/:/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../i386-redhat-linux/lib/i386-redhat-linux/3.4.2/:/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../i386-redhat-linux/lib/:/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../i386-redhat-linux/3.4.2/:/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../:/lib/i386-redhat-linux/3.4.2/:/lib/:/usr/lib/i386-redhat-linux/3.4.2/:/usr/lib/
 
Old 02-15-2005, 10:35 AM   #6
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,187

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Opps, sorry for the above. You'll need to scroll your browser sidewise to see the long lines.

I'll try to format better in the future.

(Hey, newby mistake! Sorry.)
 
Old 02-15-2005, 11:51 AM   #7
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
Re: Status

Quote:
Originally posted by GlassEyeSlim

Is the solution simply a matter of getting the compiler to look in the proper directory?

GES
hi,
no i don't think so
when i said earlier that c++ dir was in the wrong place i was wrong
those ../../../.. lead back to /usr/include
i mistook them for truncated long lines the way this board does with urls (sorry)

gcc really has a very fixed (hard coded) way of finding and using it's headers and libs.

the /usr/include/c++ files seem to be the wrong files (or a patch was left out ) but that's just a guess

try this just for fun
back up the file /usr/include/c++/3.4.2/i386-redhat-linux/bits/codecvt_specializations.h
you know
cd /usr/include/c++/3.4.2/i386-redhat-linux/bits/
cp codecvt_specializations.h codecvt_specializations.h.OLD
then edit codecvt_specializations.h and move line 270
to the end of the line above it
start with
Code:
  __iconv_adaptor(size_t(*__func)(iconv_t, _T, size_t*, char**, size_t*),
                    iconv_t __cd, char** __inbuf, size_t* __inbytes,
                    char** __outbuf, size_t* __outbytes)
change to
Code:
 __iconv_adaptor(size_t(*__func)(iconv_t, _T, size_t*, char**, size_t*),
                    iconv_t __cd, char** __inbuf, size_t* __inbytes, char** __outbuf, size_t* __outbytes)
it's worth a try to see if you can fix it easily
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
troubles with SATA, troubles with NVIDIA aevangelica Linux - Hardware 6 10-17-2005 03:39 AM
Some troubles harken Debian 25 01-30-2005 02:36 AM
Troubles tryinglinux Linux - Newbie 6 05-06-2003 11:19 AM
HP 3c troubles Tinkster Linux - Hardware 2 02-07-2003 03:11 PM
cd-rw troubles. dissolved soul Linux - Hardware 11 09-23-2002 12:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration