4

I have an existing project that I compile on both Windows using Visual C++ 2008, and Debian Linux. This project uses a standard Visual C++ .vcproj file, and some .cpp and .h files. It does not rely on any Windows specific stuff. Just plain C++.

It compiles and run well on Linux, using a home made tool that reads the .vcproj file to generate a Makefile which is used with make to compile and link all files using g++.

The trouble is that with Visual C++ 2010 (and 2012), the format of the project files have changed. Even the name has been changed from .vcproj to .vcxproj. My home made tool cannot read this new project file to generate the Makefile.

Instead of upgrading the home made tool to support new project files, I was wondering if xbuild would be able to compile my Linux executable?

I tried first to compile my own (VC++2008) project, but xbuild complains that my project is a VS2003 project, which is not supported by xbuild. However when googling on this matter, I find that xbuild is supposed to support VS2005 project files. There are also some references to mdtool to support these old project files, but I seems to be integrated into xbuild now.

Furthermore, I tried to compile a Visual C++ 2010 example (HuoChess) got from the MSDN site. The result is

/Microsoft.Cpp.Default.props: Project file could not be imported, it was being
imported by [...] /HuoChessConsole/HuoChessConsole.vcxproj: Imported project:
"//Microsoft.Cpp.Default.props" does not exist.`

Now, this looks like the project file wants some Microsoft definitions of rules for the Cpp compiler. Should I fake these definitions to use gcc instead? How can I do this?

Is what I want to do ever possible with xbuild?

Didier Trosset
  • 36,376
  • 13
  • 83
  • 122
  • The best option is to create brand new mono project with the files used in vs2010 project and edit the configuration accordingly. Trying to match msbuild and other msstuff to anythig reasonable is wasting of time. – V-X Apr 02 '13 at 15:43
  • Applying the only rule of sticking with relative paths (to avoid drive letter), a tool can easily change all ` \ ` to ` / ` . It can even get environment variables and change `$(ProjectDir)` et al. macros. That's at least what I've been doing very successfully for more than 8 years. – Didier Trosset Apr 02 '13 at 15:46

1 Answers1

2

There is a project GCCBuild which you can use to build vcxproj projects in Linux. It simply uses same vcxproj but uses GCC to compile and build. There are multiple examples there too.

PS. I am the author of that project.

Roozbeh G
  • 427
  • 4
  • 18