• Advertisement
Sign in to follow this  

Cross Platform Compiler?

This topic is 3193 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Thanks for the advice so far. Looking into everyone's suggestions. :)

Share this post


Link to post
Share on other sites
I don't really know SCons but I've seen CMake do some pretty awesome tricks.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement