warning MSB8012 building fltk.sln for VS 2015 - c++

I have installed the latest version of fltk 1.3.3. I run into build errors every time I want to build the "Demo" project in VS 2015. I have seen the same question for older versions of VS; none of them seem to help me resolve this issue. I've tried to change the debug information format to the other available values but this has not helped. In fact when I tried to build a release version, avast kicked in and blocked the whole thing. When it comes to dealing with the $(OutDir), $(TargetName) and $(TargetExt) property values, I'm totally out of my depth. This takes me to Microsoft.CppBuild.targets which is something I don't want to mess with. FLTK is SUCH a pain to do anything with from beginning to end. This is the message I get:
"MSB8012 TargetPath(C:\Users\Pablo\Desktop\c++ course files\Visual C++\fltk-1.3.2\ide\VisualC6.\Debug/Demo\Demo.exe) does not match the Linker's OutputFile property value (C:\Users\Pablo\Desktop\c++ course files\Visual C++\fltk-1.3.2\test\Demod.exe). 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). Demo C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets 1189"
If there's anyone out there with some ideas as to how to resolve this, I'd greatly appreciate that. I've spent the whole day trying to figure this out.

It looks like the target specified by the linker (C:\Users\Pablo\Desktop\c++ course files\Visual C++\fltk-1.3.2\test\Demod.exe) is different than the target specified by the compiler (C:\Users\Pablo\Desktop\c++ course files\Visual C++\fltk-1.3.2\ide\VisualC6.\Debug/Demo\Demo.exe).
If you right click on your project > Properties > Configuration Properties > General
Make sure that "Output Directory" and "Target Name" match Configuration Properties > Linker > Output File.
You could make them the same by setting Linker > General > Output File to
$(OutDir)$(TargetName)$(TargetExt)
If your Linker's output file is already set to that, then the macros are somehow wrong.

Related

LNK1181 on non-used file openssl/librtmp

I am building an universal windows app in c++, in which I'm using librtmp. I worked through a load of error messages, but I can't solve one of them:
LINK : fatal error LNK1181: cannot open input file 'C:\OpenSSL-Win64\lib.obj'
I did a ctrl+shift+f on the entire project, and I couldn't find a reference to lib.obj anywhere, so I don't know where this file is linked in. I checked if the additional dependencies were set correctly, without quotation marks, which was the case.
I also tried running the linking process with the /verbose flag, but that didn't return any useful information:
1>
1> Starting pass 1
1>LINK : fatal error LNK1181: cannot open input file 'C:\OpenSSL-Win64\lib.obj'
Does anyone have an idea how to solve this problem, or any pointers on how to diagnose the linking process better?
The vc++ linker is quite verbose when the /verbose switch is turned on. From what you get as a response, it hasn't even started to search libraries for the obj. This means that the obj file is part of the input, directly on the linkers command line.
Check the "CommandLine" properties for the given obj (Maybe it sneaks in there in the form of some kind of macro?). Also, make sure you are not inheriting some "Additional dependencies" from another configuration. Also, make sure you checked the "Additional dependencies" for the configuration/platform set that you are building.
Also, under Tools -> Options -> Projects and Solutions -> Build and Run, turn up the verbosity of the msbuild output. This way you also get the actuall commands passed to the various tools. (This is basically the content from the response files.) The obj you are looking for must end up in that somehow and turning up the verbosity should give you a handle to find out where it's actually coming from.

vc++ compile error RC : fatal error RC1107: invalid usage; use RC /? for

I am getting following error while building my vc++ project (Using visual studio 2010)
RC : fatal error RC1107: invalid usage; use RC /? for
I know there is some issue while building resources but how to get the exact problem area?
Thanks
Solution:
Add a slash to the last include path will do the trick.
If your last include path already contain a slash at the end, delete it will also work.
Note: Some other include paths can cause this too; it doesn't have to be the very last include path. In particular, check the last include path that you add (in addition to the built-in ones) in your project/properties file.
I had a similar problem. I solved it removing the trailing backslash from the last path in Include Directories (from Project Properties | Configuration Properties | VC++ Directories).
I got this when upgrading from VS2008 to VS2010. None of the suggested solutions worked for me.
What worked for me was deleting all the files in the configuration build folder (e.g. Release) and rebuilding the solution.
I also solved this problem by removing VS include path "\" from last entry.
My solution for VS2010:
click menu "Project","Properties" to open Property pages.
click "Configuration properties", "general" to change Output Directory from "$(Configuration)\ \" to "$(Configuration)\" ,change interminably directory from "$(SolutionDir)$(Configuration)\ \" to "$(SolutionDir)$(Configuration)\".recompile and it's OK.
I experienced that both with VS2015 and VS2017 .
Pls look in 1, at the answer of AH214.
In some cases the Resource Compiler fails to understand the options of the RC command line created by Visual Studio .
To find the problematic option do:
In VS2015, as described by AH214, copy the command line options listed in Project -> properties -> Configuration Properties -> Resources -> Command Line .
Find some *.rc file on your machine.
Open Visual Studio command prompt.
Issue the command
RC [the options copied in (1)] [the path to the rc file in (2)] .
You should get the same RC1107 error.
Check in this property page the contents of ...Resources -> All
Options . Look for a suspicious option and fix or remove it.
Repeat (4) and (5) till you do not get the RC1107 error in (4).
Once you found the culprit, check if you can change it or even remove
it.
I had this issue with VS 2017. The problem was that I did not notice that I had the build configuration set to Release and there was a string in one of the controls that was too long and needed to be truncated by the resource editor when the resources were loaded. Putting the build configuration back to Debug and attempting to open the Resource file fixed it. I got a different message this time: string too long - truncated, and the resources could be viewed now.
the backslash trick didnt work for me. but i just added a new icon to the RC file and then it worked all fine for me.

CPP unit build error in VS 2010

I am builidng CPPunit 1.12.1 using VS 2010. I able to build CPP unit successfully on VS 2008. I am building only CPPUnit library.
I am getting following error. How can i fix this error.
error MSB3073: The command "copy "D:\src\cppunit\.\Debug\cppunit.lib" ..\..\lib\cppunit.lib
:VCEnd" exited with code 1. C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets 113 6 cppunit
I am also mentioning one of warnings which is related to error i think so.
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(1151,5): warning MSB8012: TargetPath(D:\src\cppunit\.\Debug\cppunit.lib) does not match the Library's OutputFile property value (D:\src\cppunit\Debug\cppunitd.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).
These are post-build event errors.
Right click on your project-name in Visual Studio Solution Explorer:
Properties >> Post-Build Event
Remove the text from CommandLine textbox if you don't want post-build events. Or fix the path!
The issue is that the post-build step is something like: copy "$(TargetPath)" ....\lib\$(TargetName).lib.
Since the 'TargetName' value changes depending upon the build type, go in the project properties and change the 'target name' depending upon the selected build. In your case, if you check your 'warning' carefully, you will find that you are trying to copy the cppunit.lib to the ..\lib folder when actually your expected output is supposed to be cppunitd.lib. TargetName mismatch!
Another thing that I found helpful (it may be something only I observed) was building the 'release' build first, followed by the 'debug' build.
You have the configuration slightly messed up.
You are telling MSVC to create an output file in one directory and then use it from a different one - and it looks like at least one of the dirs doesn't exist.
It's nothign to do with cppunit

Linker outfile property file does not match targetpath?

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?
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...).
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.
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
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.
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)
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 .)
Looks like it's not significant for the program:
Odd Visual Studio error when following the custom study video
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.

What are C2471,C1083 errors related to a VC2008 project and how to correct them

I had a VC2008 project very complicated.Inorder to understand it's inner workings I tried to simplify it and now I am getting 289 errors of the following type for most of the files:
Error 5 error C2471: cannot update program database 'c:\users\ryan\documents\visual studio 2008\projects\vc\myinfo\cli\debug\vc90.pdb' c:\users\ryan\documents\visual studio 2008\projects\vc\myinfo\cli\mediainfo\file__analyze_buffer_minimizesize.cpp 1 CLI
Error 6 fatal error C1083: Cannot open program database file: 'c:\users\ryan\documents\visual studio 2008\projects\vc\myinfo\cli\debug\vc90.pdb': No such file or directory c:\users\ryan\documents\visual studio 2008\projects\vc\myinfo\cli\mediainfo\file__analyze_buffer_minimizesize.cpp 1 CLI
My system : win7/VS2008
Solution 1: Locate *.vcxproj file in your solution, open in a text editor and search for 'DebugInformationFormat' and set it to 'OldStyle'.  Reload your project and build. If you have multiple projects in your solution, this change needed for all the *.vcxproj files.
< DebugInformationFormat>OldStyle< /DebugInformationFormat>
Solution 2: From Visual Studio, on every project in your solution right click and open Properties. Expand 'Configuration Properties' > 'C/C++' > 'General'. Change the 'Debug Information Format' to 'C7 compatible (/Z7)'. Then build your solution.
This worked for me. (YMMV = Your mileage may vary:)
I've seen the same behaviour when converting a VS2003.Net solution to run on later IDEs. My guess is that your solution contains multiple projects which point to the same intermediate directory. In VS2005 and later, projects that don't depend on each other can be built in parallel so that if the same working dir is used, you can get file conflicts like this.
Check this as follows. In Solution Explorer, right click on one of the failing projects and select Properties. In Configuration Properties -> General section, make sure that every project has a different 'Intermediate Directory'. Try your build again using 'Rebuild Solution' to clean everything out.
Most of the times when I get "C2471: cannot update program database" it's because the PDB file is locked for some reason. Usually in my case that turns out to be because I have the program running in some other window, which loads the PDB file in to memory.
When that's not the reason, I find doing a rebuild-all magically fixes the problem.
I've encountered the same type of error myself with no end of frustration.
I finally fixed it by applying the Microsoft hot fix found in this knowledge base article: http://archive.msdn.microsoft.com/KB946040
This worked for me.
Kill mspdbsrv.exe and reload Visual C++
MSDN
You can delete the *.obj file and rebuild the solution again, This problem might solve. Below link might be helpful for you-
https://social.msdn.microsoft.com/Forums/vstudio/en-US/0ceac3c6-62f6-4fdf-82e1-d41e1b4fcd20/vs2008-c2471-cannot-update-program-database?forum=vclanguage