#1 Incorrect C++ linking order with -lunix and clib2

open
nobody
None
5
2012-09-21
2005-08-25
Steven Solie
No

The linking order is currently incorrect for C++
programs that wish to use clib2 with the unix path feature.

I'm using the following compile command line:
g++ -o test test.cpp -lunix

Which defines the linking order is as follows:
-lunix
-lstdc++

This will fail if the C++ program uses fstreams because
fstreams uses fopen() et al underneath.

The correct order should be as follows:
-lstdc++
-lunix

I'm not sure where this needs to be corrected but I was
unable to do any adjustment in the specs file.

As a workaround, C++ programmers can do the following:
g++ -o test test.cpp -lstdc++ -lunix

Discussion


Anonymous


Cancel   Add attachments