Problem solve Get help with specific problems with your technologies, process and projects.

Can I have multiple source files listed in a single solution?

My environment is C/C++ under VS.NET 2003 edition.

I port games amongst cell phone handsets; part of the testing is building a DLL that runs on a PC-based emulator. Each game has several source files. I also have a file from the SDK I need to include with each build. I have two SDK versions. So I need either c:/vendor/version_1/src/foo.c or c:/vendor/version_2/src/foo.c. Foo.c never changes, so I want to build it out of the vendor's SDK distribution.

I also need to include header files from either c:/vendor/version_1/inc, or c:/vendor/version_2/inc.

Right now I have one solution per game, with several configurations to deal with the handsets. It works very well except for that pesky foo.c file.

Ideally, I'd like to have a single variable, $(VERSION) or some such, and key the SRC and INC directories off this. If that isn't possible, can I somehow have multiple source file listed in a single solution?

If all else fails, I can use a pre-build rule to copy the foo.c file to the local directory, and a post build rule to delete the silly thing. This seems, well, silly.
Here's an idea: why not create a file in your project called MYFOO.C that only consists of a single line that looks like this:

#include <foo.c>
Then, each configuration has a different include directory for foo.c based on the version (which you already do for the header files).

Dig Deeper on Win Development Resources

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.