Run C++ projects without compiler

Dec 6, 2015 at 8:32pm
Hi guys,
I have made some basic board games in C++ like Tic-Tac-Toe, Hangman and a few others.

I want to share those with my friends who do not have a C++ compiler.
All my projects are console applications in either VisualStudio or Netbeans. And they want to run it on Mac/Linux environment.
I was thinking about sending the .exe file but it won't run on Mac/Linux.

So is there any solution to this?

Thanks!
Dec 6, 2015 at 8:34pm
Run up a virtual machine (using VirtualBox, for example), install Linux on it, build your code on it and send them the resulting executable.

Alternatively, you could look into "cross compiling", but that's such a pain that the easier solution really is to just have a virtual machine with the OS of your choice on it.
Last edited on Dec 6, 2015 at 8:35pm
Dec 6, 2015 at 9:11pm
@Moschops,
Thanks, but installing virtualBox and linux on it seems too complicated and time consuming.

Is there any faster solution to this?
Dec 6, 2015 at 9:17pm
You might be surprised how easy it is to create a new virtual machine. Alternatively, there are even existing virtual machines. You install virtuabox, then just download and run the new VM. It's really pretty simple.

http://www.osboxes.org/ubuntu/

By comparison with that option, setting up cross-compiling to make Linux executables on your windows machine would actually be of comparable complexity.

http://metamod-p.sourceforge.net/cross-compiling.on.windows.for.linux.html

I apologise for the troll pollution around here. Someone will get round to dealing with it.
Last edited on Dec 6, 2015 at 9:22pm
Dec 7, 2015 at 1:39am
@Moschops,
Hey, thanks. I installed the virtual machine and linux (ubuntu) is running perfectly inside the virtualbox.
Now, how do I compile C++ programs in that and generate linux executables. I don't see visual studio or netbeans in it.
Dec 7, 2015 at 1:58am
Try copy your source code into the virtual machine, and compile it with command line.

I think most Linux distribution has GCC. Try compile your program:

g++ -o mygame mygame.cpp

And the output file 'mygame' is an executable which could run on Linux.
Topic archived. No new replies allowed.