Compile Firefox add-on in Visual Studio 2012 [duplicate] - visual-studio

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Compiling a MFC app from Visual Studio 2010 to 2012 RC results in LNK2038
I am moving an XPCOM Firefox add-on project from Visual Studio 2010 to Visual Studio 2012. When I open up the project, Visual Studio asks if I want the project to use the latest C++ compiler. If I say no then I get this compile error:
Error 1 error MSB8020: The builds tools for Visual Studio 2010
(Platform Toolset = 'v100') cannot be found. To build using the v100
build tools, either click the Project menu or right-click the
solution, and then select "Update VC++ Projects...". Install Visual
Studio 2010 to build using the Visual Studio 2010 build
tools. C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets 42 5 FF
(Visual Studio 2010)
If I say yes then I get five of these compile errors for xpcomglue_s_nomozalloc.lib in the xulrunner-sdk\lib directory:
error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't
match value '1700'
I cannot install Visual Studio 2010. I suppose I could compile Gecko myself, using Visual Studio 2012, although that seems like a lot of work and I'm not sure it will work. So please let me know the best way to compile my Firefox add-on in Visual Studio 2012.

When you are compiling binary XPCOM components you must use the same compiler as used to compile Firefox itself - otherwise the binary compatibility is just not given. Currently this means using Visual C++ 10, be it via the free Visual Studio Express 2010 or by some other means.
If the purpose of the XPCOM component is just to run some native code then you might consider compiling a regular DLL instead and calling it via js-ctypes, then you can use any compiler you like - no binary compatibility constrains (it is also generally recommendable since you no longer need to recompile for each Firefox release).

Related

Build fails for C++/CX project with v141 platform toolset in Visual Studio 2019

I have tried to switch to Visual Studio 2019 since it is now officially released, but I am having problems building a C++/CX based project.
I have not retargeted the project, but it is still configured to use the v141 platform toolset, i.e. Visual Studio 2017 Build Tools.
As far as I can tell, I have specifically installed the required build tools in Visual Studio 2019, which should be evident here:
Still, according to the project properties, Visual Studio 2017 Build Tools are not installed:
And when I build the project I get the following error:
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(378,5): error MSB8020: The build tools for Visual Studio 2017 (Platform Toolset = 'v141') cannot be found. To build using the v141 build tools, please install Visual Studio 2017 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution".
Am I still missing some components in my installation, or is this a bug in Visual Studio 2019?
EDIT I should point out that I still have Visual Studio 2017 installed on the same computer as well.
I had a similar issue, but this is what I was missing.
You will find these options on the Workloads tab of the VS installer on the right under Installation details (i.e. not under Individual components).
It turns out that the (Windows Runtime Component) project was not properly set up. In the .vcxproj file the ApplicationTypeRevision element was missing, which is also "evident" (if you know what you are looking for...) from looking at the project properties above, where only the General configuration properties node is visible, and the Target Platform value is empty.
Inserting the following line in the .vcxproj file immediately following e.g. the WindowsTargetPlatformMinVersion element should do the trick:
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
Most likely, it was also necessary to add the C++ Universal Windows Platform Tools. The v142 version was made available when trying to create a new C++ Universal Windows Platform project. As far as I could tell, this component was not otherwise visible in the Visual Studio Installer? Once the v142 component was installed, the corresponding v141 component was also available for installation.
I had this same problem for Visual Studio 2017, even though V141 was explicitly shown as installed. It turned out the problem was that VCTargetsPath was set in System Environment Variables to "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\V4.0\V140". Removing or unsetting this variable solved the issue.
I suspect this variable was set during an earlier install of Visual Studio 2015. Even after uninstalling all other Visual Studios the variable was never removed and the problem persisted.

Setting up Firefox build

I am getting this error in start shell MSCV 2015
ERROR: Cannot determine the location of the VS Common Tools folder
It looks like you're missing the build pre-requisites. At this time, it means you need to have installed Visual Studio Community 2015 Update 3 with C++ support. As the docs state:
Firefox relies on C++ features that aren't supported in older versions
of Visual Studio. Do not accept the default configuration. Instead,
select Programming Languages > Visual C++ > Common Tools for Visual
C++ 2015.

Debugging information does not match, when using v60 platform toolset inside Visual Studio 2013

I am using Visual Studio 2013, but I'm in need to develop an old project using the Visual C++ 6.0 compiler.
For this purpose, I have been using Daffodil with no problem on Windows 8.1 for a while.
(You can read more how to use the VC++ 6 compiler in newer Visual Studio versions in this StackOverflow question: Is it possible to use the VC++ 6 compiler in Visual Studio 2012?)
Now I got a new Windows 10 machine, where I reinstalled Visual Studio 6, 2010, 2013 and Daffodil.
Using v60 build tools (Visual C++ 6.0 compiler), project gets compiled fine.
However, when I try to debug, VS says that "debugging information does not match", and I am unable to set breakpoints etc., but:
PDB file is there, same folder and name of debug executable;
Application built in Debug mode, with debug information enabled;
Debugger works fine when using Visual Studio 2010 or 2013 build tools;
Debugger works fine if opening the project inside Visual C++ 6 IDE.
I tried reinstalling all Visual Studio versions as well as Daffodil, but didn't solve.
Any clue what could the problem be?
Finally I actually found a working solution!
for VS 2013:
Enable "Native Edit and Continue"
under Tools->Options->Debugging->Edit and Continue
for VS 2015:
Enable "Use Native Compatibility Mode"
under Tools->Options->Debugging->General

Visual Studio 2013 and Cmake?

I have been using 2010 on a project. The project was built using cmake, when cmake chose to use the compiler Visual Studio 2010. Now I intend to move the whole set up of the project to Visual Studio 2013.
So, today I installed Visual Studio 2013. But when I try to use cmake to build the project for visual studio 2013, in the compiler list of cmake I cannot see any compiler of Visual studio 2013, the latest are Visual Studio 2012, Visual Studio 2012 win64, Visual Studio 2012 ARM.
Is there no exclusive compiler for Visual Studio 2013? Does the same compiler work for both VS2012 and VS2013? If Visual Studio 2013 indeed has an exclusive compiler, why can't cmake find the that compiler?
Thanks.
Try updating your CMake version.
The Configue dialog in cmake-gui for CMake 3.1 lists the respective entries as Visual Studio 12 2013:
In older CMake versions (older than 3.0) the entries omitted the year and showed only the version number, so the entry just reads Visual Studio 12.
If your CMake version is even older, there might not be support for Visual Studio 2013 at all. However, you should still be able to open project files generated for an older Visual Studio version. This might require an additional conversion step by Visual Studio, which might mess things up.
Upgrading CMake is definitely the preferred solution.

How can we compile OpenHaptics v3.0 with Visual Studio 2010?

I want to compile my Haptic Application with Visual Studio 2010 but the Academic Edition of OpenHaptics v3.0 supports Visual Studio 2005 compiler only.
VS2005 doesn't have any problem I can compile and run my application with no issue, but due to other libraries I want to move to VS2010.
Is there any way that I could use VS2010 with OpenHaptics® v3.0. The only problem with hl.lib and hd.lib, I can recompile hdu.lib and hlu.lib with VS2010 successfully but I have no idea how can I compile hl.lib and hd.lib with VS2010.
I have been thinking to use vs2010 since 1 year but still no success, any idea ?
You can use the VS 2010 IDE with the VS 2005 build tools if you install Daffodil:
http://daffodil.codeplex.com

Resources