Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set $(OutDir), $(TargetName), $(TargetExt), and %(Lib.OutputFile) with Visual Studio?

I'm trying to build gtest on Visual Studio 2010. After converting the solution file, I tried to build, and I got the following warning messages.

Warning 1   warning MSB8012: 
TargetPath(C:\Users\sucho\Desktop\gtest-1.5.0\msvc\gtest/Debug\gtest.lib) does not match
the Library's OutputFile property value (C:\Users\sucho\Desktop\gtest-1.5.0\msvc\gtest\
Debug\gtestd.lib).

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 %(Lib.OutputFile).  
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets

The message says I need to setup variables $(OutDir), $(TargetName) and $(TargetExt), together with property values specified in %(Lib.OutputFile).

How can I do that with Visual Studio (especially VS 2010)?

like image 261
prosseek Avatar asked Jan 10 '11 20:01

prosseek


People also ask

How do I change the target path in Visual Studio?

In Visual Studio, click Tools > Options. Expand Projects and Solutions and click Locations. The Projects location field defines the default location for storing new projects. You can change this path if you are using a different working folder.

Where are macros defined Visual Studio?

Select Edit and then in the Edit dialog box, choose the Macros button. The current set of properties and macros visible to Visual Studio is listed along with the current value for each.


2 Answers

I see it. Right-click the gtest project, Properties, Configuration properties, General. Ensure that the Debug configuration is selected (upper left combo). Change the Target Name property to

 $(ProjectName)d

Note the added "d" to change the name from gtest to gtestd. The warning is otherwise benign.

like image 180
Hans Passant Avatar answered Sep 23 '22 23:09

Hans Passant


I think no one has the right answer, i solved this way: in project properties pages, check if linker->General->Output file match configuration properties->General->target name & configuration properties->General->target extension.

You don't need to add any 'd', of course, is more simple set to Inherit from parent or project defaults, for all 3 variables.

Example:

Linker → General → Output File = "myproject.exe"

then:

Configuration Properties → General → Target Name = "myproject"

configuration properties → General → Target Extension = ".exe"
like image 44
user3630527 Avatar answered Sep 24 '22 23:09

user3630527