19

I'm trying to compile a C++ type .DLL for a SierraChart custom study. (Which is a financial trading application.) Here is the warning I get that I need to fix so it all points to the linker output value:

warning MSB8012:

TargetPath(C:\SierraChart\VCProject\Release\SCStudies.dll) does not match the Linker's 
OutputFile property value (c:\sierrachart\data\SCStudies.dll).

This may cause your project to build incorrectly. To correct this, please
make sure that $(OutDir), $(TargetName) and $(TargetExt)
property values match the value specified in %(Link.OutputFile).

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets

Any idea what's wrong?

not2qubit
  • 14,531
  • 8
  • 95
  • 135
FinDev
  • 4,437
  • 6
  • 29
  • 29
  • Have you tried following the steps suggested in the warning: "To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile)." – Cody Gray - on strike Jan 15 '11 at 14:40
  • To be honest I'm not sure how to do that. I'm kind of a newb to attaching visual studio to processes and with C++. – FinDev Jan 15 '11 at 19:15
  • See: http://stackoverflow.com/questions/16876429/how-do-i-fix-warning-msb8012-in-a-static-library-project-in-visual-c-2010 – Ujjwal Singh Sep 29 '13 at 12:39

8 Answers8

12

I believe this warning appears specifically when upgrading a C++ project to VS2010. Visual Studio 2010 C++ Project Upgrade Guide describes some of the caveats encountered during an upgrade. If you're uncomfortable changing project settings, then retaining the older version of Visual Studio, may work for you.

To change the %(Link.OutputFile), open the project properties. Navigate to Configuration Properties -> Linker -> General. You can set the Output File to $(OutDir)\SCStudies.dll, which should take care of your issue. You may need to repeat the change for each Configuration/Flavor you will be building (Debug/x86, Release/x86, Debug/Itanium, etc...).

sabbahillel
  • 4,357
  • 1
  • 19
  • 36
Mashmagar
  • 2,556
  • 2
  • 29
  • 38
8

Based on this answer.

I changed the following property:

Linker -> General -> Output File to "$(OutDir)$(TargetName)$(TargetExt)"

This prevented the warning to appear and the output was generated successfully.

Community
  • 1
  • 1
DanielV
  • 2,076
  • 2
  • 40
  • 61
1

The original configuration was set like:

Properties -> Linker -> General : $(OutDir)\"<'name fileA>".exe

The program tries to run "<'name_project>".exe and as result error Linked.

You need to set the configuration as:

Properties -> Linker -> General : $(OutDir)\"<'project name>".exe

DanielV
  • 2,076
  • 2
  • 40
  • 61
1

A different fix which others haven't mentioned is that by default the TargetExt is .exe and for my debug builds I changed it to be _d.exe, where instead you should be doing that in the TargetName path.

ngzaharias
  • 11
  • 1
1

The directory specified in General->Output Directory and the directory specified in the path at Linker->Output File have to match.

If you want to change the defaults do things in these order: You first configure the OutDir in General->Output Directory. E.g.

$(SolutionDir)$(Platform)\$(Configuration)\MyProgram\

Make sure Output File is consistent. E.g. this would work

$(OutDir)\$(TargetName)$(TargetExt)
Gerardo Hernandez
  • 1,889
  • 1
  • 16
  • 20
1

The comment from Gerardo Hernandez helped me.

The directory specified in General->Output Directory and the directory specified in the path at Linker->Output File have to match.

In my case I was importing a large project from Visual Studio 6 and

C:\Project\myproject\OneOfMyDlls\.\Debug\OneOfMyDlls.dll

was not equal to

C:\Project\myproject\Debug\OneOfMyDlls.dll

but

C:\Project\myproject\OneOfMyDlls\..\Debug\OneOfMyDlls.dll

would have been, after path reduction.

The problem was that the Visual Studio 2017 import had changed the output directory from ..\Debug to .\Debug assuming that the unconventional parent directory use was a mistake. In a large project with 13 DLLs of our own, (never mind second and third party DLLs too), it makes sense to collect all the DLLs in one place and ..\Debug was correct.

So while others might have had to change Linker->Output File, in my case it was General->Output Directory which needed to change as it had been corrupted by the import from Visual Studio 6.

Something like ..\Debug had become something like .\Debug after import. (The real project specific names have been removed .)

Ivan
  • 4,383
  • 36
  • 27
0

Looks like it's not significant for the program:

Odd Visual Studio error when following the custom study video

DanielV
  • 2,076
  • 2
  • 40
  • 61
FinDev
  • 4,437
  • 6
  • 29
  • 29
0

If, like me, you return to Visual Studio after 20 years, you may not know where the project properties are. In VS 2012: top of the screen "FILE EDIT VIEW PROJECT BUILD..." : choose PROJECT. Properties is the last item in the menu. Indeed for me there was a mismatch in the target name, too.

RickJansen
  • 1,615
  • 18
  • 24