How do I compile one project into multiple exe's?

Started by
4 comments, last by markr 17 years, 7 months ago
Right now I'm making a networked game for Lan party play, and I want the game to be made into three different executables: one for the server that just runs the gameworld, another for a client program that would run a local copy of the gameworld, have a pretty game interface, and interact with the server, and a third program which would just listen to the server and constantly show a "sideline" view of the game as it's played by all the clients. Other issues and difficulties about making this aside, I want to know how I can ( In visual studio 2005 ) have one project, that when I say "build", it builds all three executables, so that I can distribute them separately? I want to do it this way so that the code for shared stuff such as the gameworld can all be in one place, and just used to be compiled into multiple programs. Any help/wisdom would be much appreciated! LEPT0N
Advertisement
The easiest way is not to have one project at all. Have a single solution, with several projects. One for each executable, and one possible project for the shared portions. It might be easier to just include the shared files in each project than to create a static library, but I don't know if that'll confuse the things at all. Give it a shot and see what happens.

CM
You could just run the same executable with different command-line options.
Anthony Umfer
You can't make the default "build" build all of them, unless you create three separate projects and add all the same files to all three of them.

However, you can create a number of Configurations in the Configuration Manager (where you will typically see Debug and Release), and then configure the defined symbols differently for the different configurations. So you'd have configurations "Server | Debug", "Server | Release", "Client | Debug" etc. Then go into Batch Build and check all the ones you want to build, press Build, and out comes all the executables.
enum Bool { True, False, FileNotFound };
Quote:Original post by hplus0603
You can't make the default "build" build all of them, unless you create three separate projects and add all the same files to all three of them.

However, you can create a number of Configurations in the Configuration Manager (where you will typically see Debug and Release), and then configure the defined symbols differently for the different configurations. So you'd have configurations "Server | Debug", "Server | Release", "Client | Debug" etc. Then go into Batch Build and check all the ones you want to build, press Build, and out comes all the executables.


Thanks hplus, I'm going to look into that and see what I can find.

Also, CadetUmfer, what is this "command-line" you speak of? Must be some antequated concept from an age long ago :P
I agree with Cadet, just have a single executable with different command-line options. It really is the easiest way of reusing code between these three programs.

If you're so worried about the user having to type command-line options, give them pretty icons on the "start menu".

Personally, I'd hope anyone who is going to run a dedicated server should know how to supply command line options.

Mark

This topic is closed to new replies.

Advertisement