By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,159 Members | 981 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,159 IT Pros & Developers. It's quick & easy.

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

P: n/a
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<char>
::clear(std::_Iosb<int>::_Iostate, bool)':

/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt9basic_iosIcSt11ch ar_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_facetISt5ctype IcEERKT_RKSt6locale+0x3f):
undefined reference to `std::locale::_Getfacet(unsigned) const'
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZSt9use_facetISt5ctype IcEERKT_RKSt6locale+0xee):
undefined reference to `std::locale::facet::_Register()'
/usr/tmp/cct8tLwS.o: In function `std::locale::id::operator unsigned()':
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt6locale2idcvjEv+0x 2e): undefined
reference to `std::locale::id::_Id_cnt'
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt6locale2idcvjEv+0x 33): 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

Jul 22 '05 #1
Share this Question
Share on Google+
13 Replies


P: n/a
Try without std::

"david" <d.*******@callassoftware.com> wrote in message
news:br**********@news1.transmedia.de...
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<char>
::clear(std::_Iosb<int>::_Iostate, bool)':

/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt9basic_iosIcSt11ch ar_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_facetISt5ctype IcEERKT_RKSt6loca
le+0x3f): undefined reference to `std::locale::_Getfacet(unsigned) const'
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZSt9use_facetISt5ctype IcEERKT_RKSt6loca
le+0xee): undefined reference to `std::locale::facet::_Register()'
/usr/tmp/cct8tLwS.o: In function `std::locale::id::operator unsigned()':
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt6locale2idcvjEv+0x 2e): undefined
reference to `std::locale::id::_Id_cnt'
/usr/tmp/cct8tLwS.o(.gnu.linkonce.t._ZNSt6locale2idcvjEv+0x 33): 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

Jul 22 '05 #2

P: n/a

Igor Malner 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

Jul 22 '05 #3

P: n/a
david wrote:
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.

--
Unforgiven
Jul 22 '05 #4

P: n/a
Unforgiven wrote:
david wrote:
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.

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.


Jul 22 '05 #5

P: n/a
david wrote:
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.

--
Unforgiven
Jul 22 '05 #6

P: n/a
On Mon, 08 Dec 2003 19:31:23 +0000, david
<d.*******@callassoftware.com> wrote:
You are right but
I did not write "void main()" but just
"main ()" which implicit means "int main ()"


Only in C. C++ has never had "implicit int". Some compilers accept it
as an extension.

Tom

C++ FAQ: http://www.parashift.com/c++-faq-lite/
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
Jul 22 '05 #7

P: n/a

"david" <d.*******@callassoftware.com> wrote in message news:br**********@news1.transmedia.de...
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.
Jul 22 '05 #8

P: n/a

"tom_usenet" <to********@hotmail.com> wrote in message news:94********************************@4ax.com...
On Mon, 08 Dec 2003 19:31:23 +0000, david
<d.*******@callassoftware.com> wrote:
You are right but
I did not write "void main()" but just
"main ()" which implicit means "int main ()"


Only in C. C++ has never had "implicit int". Some compilers accept it
as an extension.


It's not even the case in C anymore.
Jul 22 '05 #9

P: n/a
"david" <d.*******@callassoftware.com> wrote in message
news:br**********@news1.transmedia.de...
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
Jul 22 '05 #10

P: n/a
P.J. Plauger wrote:
"david" <d.*******@callassoftware.com> wrote in message
news:br**********@news1.transmedia.de...
...
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!


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


Jul 22 '05 #11

P: n/a
david <d.*******@callassoftware.com> writes:
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?
--
Roger Leigh

Printing on GNU/Linux? http://gimp-print.sourceforge.net/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
Jul 22 '05 #12

P: n/a
Roger Leigh <${******@invalid.whinlatter.uklinux.net.invalid > wrote:
david <d.*******@callassoftware.com> writes:
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?

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

--
Sp******@gmx.de is never read
I'm Schobi at suespammers dot org

"Sometimes compilers are so much more reasonable than people."
Scott Meyers
Jul 22 '05 #13

P: n/a
"Hendrik Schober" <Sp******@gmx.de> writes:
Roger Leigh <${******@invalid.whinlatter.uklinux.net.invalid > wrote:
david <d.*******@callassoftware.com> writes:
> 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?

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.
--
Roger Leigh

Printing on GNU/Linux? http://gimp-print.sourceforge.net/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
Jul 22 '05 #14

This discussion thread is closed

Replies have been disabled for this discussion.