undefined reference to `__w32_sharedptr_unexpected'

Brian Dessent brian@dessent.net
Mon Jun 2 18:04:00 GMT 2008

Aaron Patton wrote:

> I've tried exporting LD_LIBRARY_PATH to the mingw/lib. I've tried adding

LD_LIBRARY_PATH is not applicable to MinGW.

> the -Wl, -brtl flag (I'm not sure it I did correctly -- It kept saying
> that it did not recognize the -brtl option)
> Anyways, I've run out of ideas. I'm a beginner. So go easy on me.

Since you are linking C++ (by way of ChanIO.o in libiolib.a) you should
be using the g++ binary to link, not gfortran.  This will add the
necessary options.  You should never have to specify -lstdc++ yourself,
the driver is responsible for that.  (The problem you are seeing is that
-lstdc++ itself requires -lsupc++ which you are not providing, but again
these are not things the user should be providing.)

Also note that "-Wl" by itself does nothing, it is meant to be used in
conjunction with another option as it tells the driver to pass that
option on to the linker.


More information about the Gcc-help mailing list