Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm want to use a pre-build event in Visual C++ 6.0 to run a script which will automatically generate a .cpp and .h files, but I am not sure how these files could add to project ... So when I build the project
1) script has to generate .cpp and .h files
2) Needs to add these files to project
3) Has to do a rebuild all.

can any point me in a right direction to achieve this ? any sample application also appreciated. Thank you very much in advance.

SKS
Posted

1 solution

If the generated files are always the same (same number of files and same names), you can run your script manually, then add the generated files to your project; after that, each time you rebuild the project, the files will be re-generated, then compiled.
 
Share this answer
 
Comments
kishoresajja 12-Aug-10 10:30am    
Hi Sauro,
Thanks for your response, I thought the same approach but these I am not sure what would be the case if these auto generated files has to be used by other files in the project. I mean if these files are re-generated every time we do a rebuild then how the other files will include these auto generated files ?

Is there a way to force certain files to re-generate every time we rebuild our project? If not once we added these auto generated files manually how come they re-generated every time we rebuild ? Aren't they just normal files once we add them manually ? please bear with me ..
Sauro Viti 12-Aug-10 11:01am    
On Visual Studio the pre-build step is executed before than compiling and linking steps, then you have to put the command for executing your script in the pre-build step command line.
This way your script is executed each time you build or rebuild your project; after that all the files in the project are compiled, then all includes are processed properly.
kishoresajja 13-Aug-10 13:01pm    
Thanks Sauro,

I will try this and will get back to you If I had any questions. Once again I really appreciate your help.

SKS
kishoresajja 17-Aug-10 13:18pm    
I add the files that are the input to create the .cpp/.h files to the project and gave those a custom build step and it is working fine.. thanks sauro for your time

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900