Reputation: 4547
Is it possible to create multiple c++ files and compile them as isolated files in one project in Visual Studio?
For Instance,
Program 1 --> Does Operation 1
Program 2 --> Outputs Hello
Right now, if I create two separate files, it shows the following error
fatal error LNK1169: one or more multiply defined symbols found
Any workaround for this? Or need to create separate VS projects for the same?
Upvotes: 0
Views: 1483
Reputation: 171167
The basic definition of a Visual Studio project (.vcxproj
file) is "a collection of source files and settings whose compilation results in one binary (executable or library) file." By definition, if you want two separate executables, you want two separate projects.
Both of these projects can be part of the same Visual Studio solution (.sln
file). Solutions are the things you open in Visual Studio — each running Visual Studio has one solution open (unless it's empty).
If you're familiar with Make, think of a Visual Studio solution as of a Makefile
, and of Visual Studio projects as of invididual targets in that makefile.
Upvotes: 6