I have a sample directory of some software, which contains multiple files with multiple main
functions. May I assemble all of these files into single project, compile them and then run specific ones without getting main already defined
error? Suppose I don't want to create separate project for each cpp file.
UPDATE
I need simple one-two-click solution (if it exists). I don't want to distribute files among folders or refactor files content. For example in Eclipse/Java you can right-click any file with main and run it. And there can be many of main files in one project. Is this possible for VisualStudio/CPP?
UPDATE 2
I know that C++ is not Java and that Visual Studio is not Eclipse. My question is about automation of some manual operations.
I haven't worked OpenCV, but it uses cmake, and has a CMakeLists.txt in the sample directory. There's some discussion about building the samples using cmake here.
Cmake doesn't build anything itself, it generates build scripts for the target platform, and should be able to create Solution and Project files that you can load into Visual Studio.