digitalmars.D.learn - How to compile C++ and D code, and linking them together on Windows,I
Hi,everyone, How to compile C++ and D code, and linking them together on Windows ? I will use c++ function In D. I use vs2010 c++ on Windows, What should I do? For example: 1. create 2 files: C++.cpp D.d 2. I get the C++.obj fiel by vs2010. 3. I get the D.obj by dmd -c -m32mscoff Then how to link? use Dmd's link or VC's link? Now I use the VC's link,and dmd -c -m32mscoff.but get the error:phobos32mscoff.lib<...>:error LNK2001.... Total 187 errors. Thanks.
Feb 25 2018
On Sunday, 25 February 2018 at 15:38:31 UTC, FrankLike wrote:Hi,everyone, How to compile C++ and D code, and linking them together on Windows ? I will use c++ function In D. I use vs2010 c++ on Windows, What should I do? For example: 1. create 2 files: C++.cpp D.d 2. I get the C++.obj fiel by vs2010. 3. I get the D.obj by dmd -c -m32mscoff Then how to link? use Dmd's link or VC's link? Now I use the VC's link,and dmd -c -m32mscoff.but get the error:phobos32mscoff.lib<...>:error LNK2001.... Total 187 errors. Thanks.I've done it by myself. Through ‘LINK’ each *.obj from D or C++,if there is no problem,linking them together,add parameters:/NODEFAULTLIB:libcmt.lib ,and not use /LTCG. Ok.
Feb 25 2018