dinkumware 402 linking with g++ 3.x/ _Winit undefined ref

I

Igor

Try without std::

david said:
Hi,

I have some problems to link a simple hello world program using
g++ (version 3.2.3 or 3.3) and dinkumware 402.

//hallo world...
#include <iostream>
main () {
std::cout << "bla" << std::endl;
}

// the linking is something of that kind...
g++ -I./dinkumware_co/include ./libgcc_v3.2_c99_standard.a test.cpp

then I get:

/usr/tmp/cct8tLwS.o: In function
`__static_initialization_and_destruction_0(int, int)':
/usr/tmp/cct8tLwS.o(.text+0x74): undefined reference to
`std::_Winit::_Winit[in-charge]()'
/usr/tmp/cct8tLwS.o(.text+0x8f): undefined reference to
`std::_Winit::~_Winit
[in-charge]()'
/usr/tmp/cct8tLwS.o: In function `std::basic_ios<char,
std::char_traits said:
::clear(std::_Iosb<int>::_Iostate, bool)':
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt9basic_iosIcSt11char_traitsIcEE5cle
arENSt5_IosbIiE8_IostateEb+0x3c):
undefined reference to `std::ios_base::clear(std::_Iosb<int>::_Iostate,
bool)'
/usr/tmp/cct8tLwS.o: In function `std::ctype<char> const&
std::use_facet<std::ctype<char> >(std::locale const&)':
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZSt9use_facetISt5ctypeIcEERKT_RKSt6loca
le+0x3f):
undefined reference to `std::locale::_Getfacet(unsigned) const'
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZSt9use_facetISt5ctypeIcEERKT_RKSt6loca
le+0xee):
undefined reference to `std::locale::facet::_Register()'
/usr/tmp/cct8tLwS.o: In function `std::locale::id::eek:perator unsigned()':
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt6locale2idcvjEv+0x2e): undefined
reference to `std::locale::id::_Id_cnt'
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt6locale2idcvjEv+0x33): undefined
reference to `std::locale::id::_Id_cnt'
/usr/tmp/cct8tLwS.o: In function `std::ctype<char>::ctype[in-charge](short
const*, bool, unsigned)':
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt5ctypeIcEC1EPKsbj+0x37): undefined
reference to `std::_Locinfo::_Locinfo[in-charge](char const*)'
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt5ctypeIcEC1EPKsbj+0x5c): undefined
reference to `std::_Locinfo::~_Locinfo [in-charge]()'
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt5ctypeIcEC1EPKsbj+0x6c): undefined
reference to `std::_Locinfo::~_Locinfo [in-charge]()'
collect2: ld returned 1 exit status
 
D

david

Hi,

I have some problems to link a simple hello world program using
g++ (version 3.2.3 or 3.3) and dinkumware 402.

//hallo world...
#include <iostream>
main () {
std::cout << "bla" << std::endl;
}

// the linking is something of that kind...
g++ -I./dinkumware_co/include ./libgcc_v3.2_c99_standard.a test.cpp

then I get:

/usr/tmp/cct8tLwS.o: In function
`__static_initialization_and_destruction_0(int, int)':
/usr/tmp/cct8tLwS.o(.text+0x74): undefined reference to
`std::_Winit::_Winit[in-charge]()'
/usr/tmp/cct8tLwS.o(.text+0x8f): undefined reference to
`std::_Winit::~_Winit
[in-charge]()'
/usr/tmp/cct8tLwS.o: In function `std::basic_ios<char,
std::char_traits said:
::clear(std::_Iosb<int>::_Iostate, bool)':
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt9basic_iosIcSt11char_traitsIcEE5clearENSt5_IosbIiE8_IostateEb+0x3c):
undefined reference to `std::ios_base::clear(std::_Iosb<int>::_Iostate,
bool)'
/usr/tmp/cct8tLwS.o: In function `std::ctype<char> const&
std::use_facet<std::ctype<char> >(std::locale const&)':
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZSt9use_facetISt5ctypeIcEERKT_RKSt6locale+0x3f):
undefined reference to `std::locale::_Getfacet(unsigned) const'
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZSt9use_facetISt5ctypeIcEERKT_RKSt6locale+0xee):
undefined reference to `std::locale::facet::_Register()'
/usr/tmp/cct8tLwS.o: In function `std::locale::id::eek:perator unsigned()':
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt6locale2idcvjEv+0x2e): undefined
reference to `std::locale::id::_Id_cnt'
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt6locale2idcvjEv+0x33): undefined
reference to `std::locale::id::_Id_cnt'
/usr/tmp/cct8tLwS.o: In function `std::ctype<char>::ctype[in-charge](short
const*, bool, unsigned)':
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt5ctypeIcEC1EPKsbj+0x37): undefined
reference to `std::_Locinfo::_Locinfo[in-charge](char const*)'
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt5ctypeIcEC1EPKsbj+0x5c): undefined
reference to `std::_Locinfo::~_Locinfo [in-charge]()'
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt5ctypeIcEC1EPKsbj+0x6c): undefined
reference to `std::_Locinfo::~_Locinfo [in-charge]()'
collect2: ld returned 1 exit status
 
U

Unforgiven

david said:
Hi,

I have some problems to link a simple hello world program using
g++ (version 3.2.3 or 3.3) and dinkumware 402.

//hallo world...
#include <iostream>
main () {
std::cout << "bla" << std::endl;
}

I'm guessing it chokes on the fact that the main() you have defined is not
actually a function definition. Try this:

#include <iostream>
int main() {
std::cout << "bla" << std::endl;
return 0;
}

NOTE: int is the *only* valid return type for main(). void main() is not,
never has been, and never will be, valid C++. For main() without return type
it's the same story. Afaik, the only functions that you can (must, even)
declare without return type are constructors and destructors.
 
U

Unforgiven

david said:
This does not solve it , but thanks anyway.

Your problem is very likely not standard-related then. You'd have better
luck posting your question in a group where gcc/dinkumware is topical.
 
D

david

Igor wrote:

> Try without std::
Hi

sorry this does not solve the Problem. I still have the same undefined
references!

I then have to add the line after the std include:

using namespace std;

Important:
If the include path is not pointing to the correct path of the dinkumware
library, then it "works" - at least it seems so in the first view - , but
then it is linked with the libstdc++ distributed by g++, and not with the
dinkumware library!


David
 
R

Ron Natalie

david said:
I did not write "void main()" but just
"main ()" which implicit means "int main ()"
Nope. There is no implicit function return type. Your program is ill-formed.
 
D

david

Unforgiven said:
I'm guessing it chokes on the fact that the main() you have defined is not
actually a function definition. Try this:

#include <iostream>
int main() {
std::cout << "bla" << std::endl;
return 0;
}

NOTE: int is the *only* valid return type for main(). void main() is not,
never has been, and never will be, valid C++. For main() without return
type it's the same story. Afaik, the only functions that you can (must,
even) declare without return type are constructors and destructors.
You are right but
I did not write "void main()" but just
"main ()" which implicit means "int main ()"

This does not solve it , but thanks anyway.
 
P

P.J. Plauger

I have some problems to link a simple hello world program using
g++ (version 3.2.3 or 3.3) and dinkumware 402.

//hallo world...
#include <iostream>
main () {
std::cout << "bla" << std::endl;
}

// the linking is something of that kind...
g++ -I./dinkumware_co/include ./libgcc_v3.2_c99_standard.a test.cpp

then I get:

/usr/tmp/cct8tLwS.o: In function
`__static_initialization_and_destruction_0(int, int)':
/usr/tmp/cct8tLwS.o(.text+0x74): undefined reference to
`std::_Winit::_Winit[in-charge]()'
.....

If you were to read the readme.txt file that accompanies the
library, you would see that the setup/Gcc script generates
Link* and Compile* scripts with all the necessary command
line arguments. You should at least read those scripts before
essaying your own command lines. In particular, the command

../dinkumware_co/Linkx test.cpp

should work just fine.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com
 
D

david

P.J. Plauger said:
If you were to read the readme.txt file that accompanies the
library, you would see that the setup/Gcc script generates
Link* and Compile* scripts with all the necessary command
line arguments. You should at least read those scripts before
essaying your own command lines. In particular, the command

./dinkumware_co/Linkx test.cpp

should work just fine.

Yes indeed! Thank you!
 
R

Roger Leigh

david said:
I have some problems to link a simple hello world program using
g++ (version 3.2.3 or 3.3) and dinkumware 402.

Purely out of interest, why would I want (or need) to use the
Dinkumware library over the GNU libstdc++ that comes with GCC?
 
H

Hendrik Schober

Roger Leigh said:
Purely out of interest, why would I want (or need) to use the
Dinkumware library over the GNU libstdc++ that comes with GCC?


Because Coemau/Dinkumware is considered to
be the most std conformant? Because the
Dinkumware lib is used on another platform
already and this makes porting easier?

Schobi

--
(e-mail address removed) is never read
I'm Schobi at suespammers dot org

"Sometimes compilers are so much more reasonable than people."
Scott Meyers
 
R

Roger Leigh

Hendrik Schober said:
Because Coemau/Dinkumware is considered to
be the most std conformant? Because the
Dinkumware lib is used on another platform
already and this makes porting easier?

I don't mean to be facetious, but surely using *both* will make
(future) porting easier--since you will eliminate any dependency on
any non-standard extensions in either library.
 

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