0

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.

Community
  • 1
  • 1
HappyNomad
  • 4,458
  • 4
  • 36
  • 55
  • I already saw that post and this question is not a duplicate. In this case, the libraries in question are specifically those of XPCOM/Firefox. – HappyNomad Oct 07 '12 at 17:53
  • "You'll need to recompile all your .libs or run-time link with the DLLs". The solution should apply. – Lex Li Oct 08 '12 at 02:17
  • It should apply, which is why I mentioned it in my question, but: (1) Will the end result still work with Firefox? and (2) Is there a better solution, e.g. a binary out there that is already compiled as such? – HappyNomad Oct 08 '12 at 02:33
  • It amazes me how five moderators can all be wrong together. Strength in numbers! I personally don't care since Wladimir Palant already gave me the answer I need. But if you want to pollute SO with false duplicate flags like this, go right ahead. – HappyNomad Oct 09 '12 at 01:01
  • @HappyNomad The duplicate's answers say this problem is caused by a mismatch in the compilers' versions. It sure looks like it's the case here, so it's a dupe. If you still think this has been wrongly closed, you can bring the issue up on [meta](http://meta.stackoverflow.com) (PS: those aren't mods, they are five users like you. If you can get five users to agree with you that this isn't a dupe, it will get reopened). – NullUserException Oct 09 '12 at 07:48
  • The answer says a lot more than just that. Do you know what "more specific" means? The tags alone should make it clear the subject is different. Thanks for clarifying who closed it. But why should I waste my time on Meta? – HappyNomad Oct 09 '12 at 15:28
  • Still not reopened? Should have expected it. Oh well, just another useful and unique but closed SO question. At least they didn't delete it (yet). – HappyNomad Feb 04 '13 at 05:13

1 Answers1

1

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).

Wladimir Palant
  • 56,865
  • 12
  • 98
  • 126