www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - how to lin standard C++ libraries

reply "Milvakili" <maliy.kayit gmail.com> writes:
Hi,

I m trying to link c++ and d code, but I keep getting error when 
I used stanrd library elements such as vectors or iostream.

dmd do not except -lstdc++ option so what is the correct way 
doing this?

thanks
Jun 26 2013
parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
On Thursday, 27 June 2013 at 00:19:11 UTC, Milvakili wrote:
 dmd do not except -lstdc++ option so what is the correct way 
 doing this?
Pass -L-lstdc++ to dmd. -L means pass the rest of the option to the linker, and -l of course is known to ld.
Jun 26 2013
parent reply "Milvakili" <maliy.kayit gmail.com> writes:
On Thursday, 27 June 2013 at 00:20:29 UTC, Adam D. Ruppe wrote:
 On Thursday, 27 June 2013 at 00:19:11 UTC, Milvakili wrote:
 dmd do not except -lstdc++ option so what is the correct way 
 doing this?
Pass -L-lstdc++ to dmd. -L means pass the rest of the option to the linker, and -l of course is known to ld.
I have tried this it did not work. And tells: Error: unrecognized switch '-lstdc++'
Jun 26 2013
parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
On Thursday, 27 June 2013 at 00:24:49 UTC, Milvakili wrote:
 I have tried this it did not work.  And tells:

 Error: unrecognized switch '-lstdc++'
Did you do: -lstdc++ or -L-lstdc++ ?
Jun 26 2013
parent reply "Milvakili" <maliy.kayit gmail.com> writes:
On Thursday, 27 June 2013 at 00:27:22 UTC, Adam D. Ruppe wrote:
 On Thursday, 27 June 2013 at 00:24:49 UTC, Milvakili wrote:
 I have tried this it did not work.  And tells:

 Error: unrecognized switch '-lstdc++'
Did you do: -lstdc++ or -L-lstdc++ ?
I do both of them in separate tries. -L-lstdc++ thing gives the error in the previous message.
Jun 26 2013
parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
On Thursday, 27 June 2013 at 00:29:57 UTC, Milvakili wrote:
 I do both of them in separate tries.  -L-lstdc++ thing gives 
 the error in the previous message.
Strange, I don't know what is wrong here. I've done this before with -L-l. You're on Linux using gcc for the C++, right?
Jun 26 2013
parent reply "Milvakili" <maliy.kayit gmail.com> writes:
On Thursday, 27 June 2013 at 00:36:32 UTC, Adam D. Ruppe wrote:
 On Thursday, 27 June 2013 at 00:29:57 UTC, Milvakili wrote:
 I do both of them in separate tries.  -L-lstdc++ thing gives 
 the error in the previous message.
Strange, I don't know what is wrong here. I've done this before with -L-l. You're on Linux using gcc for the C++, right?
Yep
Jun 26 2013
parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
Last thing I can think of is double check and make sure there's 
no -lxxx on your command line at all. Maybe there was a left over 
one.

But if it isn't that, I don't know... hopefully someone else will 
be of more help.
Jun 26 2013
parent "Mike Parker" <aldacron gmail.com> writes:
On Thursday, 27 June 2013 at 00:48:19 UTC, Adam D. Ruppe wrote:
 Last thing I can think of is double check and make sure there's 
 no -lxxx on your command line at all. Maybe there was a left 
 over one.

 But if it isn't that, I don't know... hopefully someone else 
 will be of more help.
Trying to link statically with libstdc++? -L-static-libstdc++
Jun 26 2013