Error 42 When Trying to Interop with a C# Libary

Mike Parker via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Nov 5 19:37:23 PDT 2016


On Saturday, 5 November 2016 at 22:06:21 UTC, Sarcross wrote:

> LINK : fatal error LNK1104: cannot open file 
> '+C:\Users\antzy_000\Documents\Programming\D\Resume-Parser\src\Parser2.lib'
> --- errorlevel 1104
> dmd failed with exit code 1104.

>   "lflags" :  
> ["+C:\\Users\\antzy_000\\Documents\\Programming\\D\\Resume-Parser\\src\\Parser2.lib"],

The error linker error tells you that the linker thinks the path 
you specified with '+' is a filename (which is why it tacked .lib 
on the end), meaning it doesn't recognize it as a command line 
option. That's because when you compile with -m32mscoff, you are 
using the Microsoft linker (link) rather than optlink, the 
default. The '+path' syntax is something optlink understands, but 
link does not. You can find the MS linker commands at [1], in 
this case you want [2]:

"lflags" : 
"/LIBPATH:C:\Users\antzy_000\Documents\Programming\D\Resume-Parser\src\Parser2"

[1] https://msdn.microsoft.com/en-us/library/y0zzbyt4.aspx
[2] https://msdn.microsoft.com/en-us/library/1xhzskbe.aspx





More information about the Digitalmars-d-learn mailing list