Dave
Dave

Reputation: 7603

Automatically add files to be compiled in visual studio

I am using Visual Studio 2010 to build an application in C++. I have a custom build event which creates additional headers and source files in a separate directory. How can I tell Visual Studio to include those generated files in its build queue. I don't necessarily need to add them to the project but I need to compile them like they are part of the project.

Upvotes: 2

Views: 1648

Answers (2)

RedX
RedX

Reputation: 15175

If the names of the files don't change, create a folder(filter) called generated and add those files to this folder(filter). If they don't exist VS won't complain when compiling, if they exist they will be included in the build.

I use this scheme when i have to use generated files.

Upvotes: 1

detunized
detunized

Reputation: 15289

I don't think it's possible (unless there's an add-on for that or something). But what you could do is to generate all those files and then add them to the project. After that in the custom build event specify them as outputs. That way VS will not try to build them before they are generated and will not complain that they are missing.

Upvotes: 0

Related Questions