VC++ Incremental Linker Error LNK1000

2019-02-19 17:49发布

问题:

Disclaimer: I am a C# guy with virtually no VS C++/MFC experience.

I am trying to get some projects built on my machine that are mixed C++/.Net. When compiling a C++ project via the command line on my machine I am getting this error:

LINK : fatal error LNK1000: Internal error during IMAGE::BuildImage [SOURCE_CODE_PATH_TO_VCPROJ]

My version of Link.exe is : 9.00.30729.1

The line of code that is triggering this is pretty simple:

System::String^ fullPath = gcnew System::String(dllpath);

When I ditch the gcnew stuff and just hardcode a string in its place everything compiles correctly.

Googling this results in a lot of posts saying that this issue is fixed with kb948127 which is included in VS2008 SP1. I've verified that I have this particular hotfix installed. I've also verified that the incremental linking is disabled with the /INCREMENTAL:NO setting but I am still experiencing the error on every compile.

Is there a setting or switch that I am missing? Has anyone run into this type of issue before?

回答1:

I've got the linker errors to go away by modifying the code to use marshal_as convert to create the System::String^ but I am not clear as to what actually triggered the linker error from the original code.

Here is the line I swapped out:

System::String^ fullPath = marshal_as( dllPath );



回答2:

I got a similar error:

Linking...
TapCommandFormat.lib(CTapCommandDisplay.obj) : fatal error LNK1000: unknown error; consult documentation for technical support options

Error executing link.exe (tool returned code: 1000)

ITP - 1 error(s), 0 warning(s)

This turned out to be because my system ran out of virtual memory. I closed a huge document that was taking about 1.4GB of virtual memory, and the problem went away...

$0.02