C++ compiler errors (OS X, QT)

T

tkietzma

Hello world,

I have some code, which happily runs on Ubuntu. Now, I have to port
this code to OS X. However, on compiling I get (hundreds of) errors
like:

/usr/include/c++/4.0.0/bits/localefwd.h:124: error: 'mbstate_t' was
not declared in this scope
/usr/include/c++/4.0.0/bits/localefwd.h:124: error: template argument
3 is invalid
/usr/include/c++/4.0.0/bits/localefwd.h:126: error: 'mbstate_t' was
not declared in this scope
/usr/include/c++/4.0.0/bits/localefwd.h:126: error: template argument
3 is invalid
/usr/include/c++/4.0.0/bits/localefwd.h:132: error: expected `>'
before 'istreambuf_iterator'
/usr/include/c++/4.0.0/bits/localefwd.h:132: error: expected
unqualified-id before '>' token
......

I am using a (qmake generated) Makefile, with the following call for
each cpp-file:

c++ -c -pipe -Wno-deprecated -I/sw/include -g3 -D_REENTRANT -
D_GNU_SOURCE -fPIC -DNDEBUG -g -g -Wall -W -DQT_GUI_LIB -DQT_CORE_LIB -
DQT_SHARED -I/usr/local/Trolltech/Qt-4.3.2/mkspecs/macx-g++ -I. -I/usr/
local/Trolltech/Qt-4.3.2/lib/QtCore.framework/Versions/4/Headers -I/
usr/local/Trolltech/Qt-4.3.2/include/QtCore -I/usr/local/Trolltech/
Qt-4.3.2/include/QtCore -I/usr/local/Trolltech/Qt-4.3.2/lib/
QtGui.framework/Versions/4/Headers -I/usr/local/Trolltech/Qt-4.3.2/
include/QtGui -I/usr/local/Trolltech/Qt-4.3.2/include/QtGui -I/usr/
local/Trolltech/Qt-4.3.2/include -I. -Iexternal -IFILOU -I. -I. -F/usr/
local/Trolltech/Qt-4.3.2/lib -o objects/iGRLVQ_Demo.o iGRLVQ_Demo.cpp

Any suggestions? This is (unfortunately) somewhat urgent because I
have to give a talk and a deadline on this on Thursday and would like
to use os x for it. It should be pretty easy (I hope)..

Greetings and thanks so much in advance, any help is appreciated.
Tim
 
M

Matthias Buelow

I have some code, which happily runs on Ubuntu. Now, I have to port
this code to OS X. However, on compiling I get (hundreds of) errors
like:

[Off Topic here but...]

Do you include wchar.h?
 
V

Victor Bazarov

I have some code, which happily runs on Ubuntu. Now, I have to port
this code to OS X. However, on compiling I get (hundreds of) errors
like:

/usr/include/c++/4.0.0/bits/localefwd.h:124: error: 'mbstate_t' was
not declared in this scope

Seems like 'mbstate_t' is undeclared... Are you sure your compiler
and library were correctly installed?
/usr/include/c++/4.0.0/bits/localefwd.h:124: error: template argument
3 is invalid
/usr/include/c++/4.0.0/bits/localefwd.h:126: error: 'mbstate_t' was
not declared in this scope
/usr/include/c++/4.0.0/bits/localefwd.h:126: error: template argument
3 is invalid
/usr/include/c++/4.0.0/bits/localefwd.h:132: error: expected `>'
before 'istreambuf_iterator'
/usr/include/c++/4.0.0/bits/localefwd.h:132: error: expected
unqualified-id before '>' token
.....

I am using a (qmake generated) Makefile, with the following call for
each cpp-file:

c++ -c -pipe -Wno-deprecated -I/sw/include -g3 -D_REENTRANT -
D_GNU_SOURCE -fPIC -DNDEBUG -g -g -Wall -W -DQT_GUI_LIB -DQT_CORE_LIB
- DQT_SHARED -I/usr/local/Trolltech/Qt-4.3.2/mkspecs/macx-g++ -I.
-I/usr/
local/Trolltech/Qt-4.3.2/lib/QtCore.framework/Versions/4/Headers -I/
usr/local/Trolltech/Qt-4.3.2/include/QtCore -I/usr/local/Trolltech/
Qt-4.3.2/include/QtCore -I/usr/local/Trolltech/Qt-4.3.2/lib/
QtGui.framework/Versions/4/Headers -I/usr/local/Trolltech/Qt-4.3.2/
include/QtGui -I/usr/local/Trolltech/Qt-4.3.2/include/QtGui -I/usr/
local/Trolltech/Qt-4.3.2/include -I. -Iexternal -IFILOU -I. -I.
-F/usr/ local/Trolltech/Qt-4.3.2/lib -o objects/iGRLVQ_Demo.o
iGRLVQ_Demo.cpp

Any suggestions? This is (unfortunately) somewhat urgent because I
have to give a talk and a deadline on this on Thursday and would like
to use os x for it. It should be pretty easy (I hope)..

Suggestion: Switch to Ubuntu for your talk. Without seeing the code
all I can recommend is to ask in OS X newsgroup.

V
 
T

tkietzma

Hi,

I don't include wchar.h or anything the like, but I include
<iostream>. I would love to switch to ubuntu for the talk, but the
slides are made by keynote and (even worse), I can't get my Ubuntu to
work with external monitors..

Here is what I get when checking c++

c++ -v
Using built-in specs.
Target: powerpc-apple-darwin9
Configured with: /var/tmp/gcc/gcc-5465~16/src/configure --disable-
checking -enable-werror --prefix=/usr --mandir=/share/man --enable-
languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/
$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/
lib --build=i686-apple-darwin9 --program-prefix= --host=powerpc-apple-
darwin9 --target=powerpc-apple-darwin9
Thread model: posix
gcc version 4.0.1 (Apple Inc. build 5465)

Does this help?

Thanks a lot.
Tim
 
T

tkietzma

Why not?

See wcstrtomb(3) on your local machine or viahttp://developer.apple.com/documentation/Darwin/Reference/ManPages/ma...

And learn to use Google.
Oh, what a good idea, I did not think of checking an Internet search
machine like google. Please, if I would not have spent the whole day
searching and not finding anything, I would not have asked...

To be honest, I still don't see why including this file should help? I
get hundreds of errors, not only for string commands,etc

T
 
V

Victor Bazarov

Oh, what a good idea, I did not think of checking an Internet search
machine like google. Please, if I would not have spent the whole day
searching and not finding anything, I would not have asked...

To be honest, I still don't see why including this file should help? I
get hundreds of errors, not only for string commands,etc

You are frustrated. You choose the last day to move onto a new setup
and it didn't work. Murphy's law. There are two ways out of here:
back (which you claim doesn't work) or forward (which you are trying
to explore, yet for some reason haven't done what's suggested). You
_could_ try to combine the two and present using 'vmware' running your
Ubuntu program on a virtual machine running on OS X... Or vice versa.
Or bring two machines and switch between them. Find somebody who will
assist you.

But here is the kicker: How is this all relevant to C++? You cannot
make your apparently non-portable program, which worked OK on Linux,
compile on OS X. We sympathise but how do you think we could help
you if you don't even post the damn code? This is a C++ *language*
newsgroup FCOL, not OS X, not Linux, not even GCC. Each major OS and
each major compiler have their own newsgroups. As much as I am sorry
to tell you this, you're in a wrong place. Find the proper place to
bother *real people* if you cannot bother yourself to find the needed
information using machines only (Google).

V
 
J

Jim Langston

Oh, what a good idea, I did not think of checking an Internet search
machine like google. Please, if I would not have spent the whole day
searching and not finding anything, I would not have asked...

To be honest, I still don't see why including this file should help? I
get hundreds of errors, not only for string commands,etc

Why don't you include it and see if it helps? You asked for help, someone
gave a suggestion. Try it. If it doesn't work, then come back and say it
didn't work.
 
T

tkietzma

You are frustrated. You choose the last day to move onto a new setup
and it didn't work. Murphy's law.
Well, this is not really about frustration, but about getting
reasonable help. "Google it" is apparently the first thing I have been
doing for the whole day. I just don't like being treated as stupid.
There are two ways out of here:
back (which you claim doesn't work) or forward (which you are trying
to explore, yet for some reason haven't done what's suggested).

I have tried to include wchar.h, but as expected, it did not solve the
problem.
You
_could_ try to combine the two and present using 'vmware' running your
Ubuntu program on a virtual machine running on OS X... Or vice versa.
Or bring two machines and switch between them. Find somebody who will
assist you.

I will use two laptops, but this is not the topic here. I wanted to
find a way of letting c++ find the standard libraries, which seems to
go wrong at the moment..
But here is the kicker: How is this all relevant to C++? You cannot
make your apparently non-portable program, which worked OK on Linux,
compile on OS X. We sympathise but how do you think we could help
you if you don't even post the damn code?

This is a C++ *language*
newsgroup FCOL, not OS X, not Linux, not even GCC. Each major OS and
each major compiler have their own newsgroups. As much as I am sorry
to tell you this, you're in a wrong place.
Find the proper place to
bother *real people* if you cannot bother yourself to find the needed
information using machines only (Google).

Sorry for _bothering_, I was hoping to find help in this group,
because it is a c++ setup problem.
 
T

tkietzma

Why don't you include it and see if it helps? You asked for help, someone
gave a suggestion. Try it. If it doesn't work, then come back and say it
didn't work.

I tried including it, but as I mentioned before, this is not only
about strings but many different standard-c++ elements. So I thought
there might be a different problem here with local variables setups
being wrong or thelike

Thanks for your help anyway.
T
 
S

Silversurfer

Just to quickly give the solution: Naturally it was _not_ about
including all standard headers of C++ but there was something
different going wrong. In a related package, there was a file called
"time.h" which lead the compiler to look for all standard headers in
the same directory. Renaming and recompiling solved the issue.

Thanks for your help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top