Cross Platform Compiler?

Started by
6 comments, last by Dolf 14 years, 10 months ago
Hello. This is probably a really silly question, but I haven't managed to find a good answer online (Google). I learned to use DirectX 9 a little while back, and decided to switch all of my code over to OpenGL. During the time I was using DirectX, I was coding everything in Visual Studio 2005, then I switched over to 2008. I'm looking for a good compiler that can work on both Linux and Windows. I've managed to get my current OpenGL code base to compile under Linux, so I'm looking for something where I don't have to worry about Visual Studio solutions. I'm currently just copying all of the code files over to the Linux box and compiling them with g++. Just looking for a less tedious way to compile on both OS's... Thanks in advance.
Advertisement
The MinGW project claims to port all of the build-utils of GNU (gcc, g++, make...) and they did it pretty good, so u just install MinGW and you get gcc/g++ for windows.
Also you can try the Cygwin its like bigger-MinGW, u can run almost everyting *nix via Cygwin, but MinGW will be enough.

I would love to change the world, but they won’t give me the source code.

Download VirtualBox. Install the OS of your choice. Use native build tools.

This way you can develop under MVS for convenience of an IDE, and compile natively on Linux.
Use g++ on both platforms, and get a cross platform IDE like Vim, Eclipse, or Code::Blocks.
You can also force VS to run gcc as it's compiler for your project if you wanted.
If your goal is just to not worry about Visual Studio solutions, then I think what you really want is a cross-platform build tool.

Two good ones are SCons and Cmake. For both tools, you just write one makefile that works across platforms.

Cmake works by generating a project file that's appropriate for your OS. On windows it generates a Visual Studio project file, on Mac it generates an Xcode project, and I don't know what it makes on Linux but it makes something.

SCons works by finding your compiler at build time. If you're on Windows, it will hunt down your VS compiler binary and use that, if you're on linux/mac it will find gcc.

I use SCons for everything and I'm pretty happy with it.
Thanks for the advice so far. Looking into everyone's suggestions. :)
I don't really know SCons but I've seen CMake do some pretty awesome tricks.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Even better, Codeblocks can import visual studio projects :)

Just do your thing in visual studio ( assuming you like visual studio over codeblocks ), then import the solution to codeblocks and compile.


Or use monodevelop, it can even export visual studio projects.

This topic is closed to new replies.

Advertisement