Sign in to follow this  
_moagstar_

Visual Studio 2005 - Outputting Pre-Processed Code causes linker error

Recommended Posts

_moagstar_    465
Hi, I am using the compiler option /P to output the preprocessed code to a file. However whenever I use this I get a LIB : fatal error LNK1181: cannot open input file Because the .obj is not being generated. Does anyone have any idea how I can get rid of this linker error - I want to be able to generate the processed code but I don't want the project to fail. Any Ideas?

Share this post


Link to post
Share on other sites
Sneftel    1788
/P causes the code to not be compiled. If you want both the preprocessed file and the OBJ to be generated in the same build (not sure why you'd want this, but okay), simply compile it twice with different options, or compile the preprocessed file.

Share this post


Link to post
Share on other sites
_moagstar_    465
Thanks for your rapid response :)

I'm only interested in the pre-processed file. I have a seperate project that uses the c pre-processor (with the help of boost/preprocessor) to generate some stubbed code for me from a set of headers, and then I'm going to use the pre-processed file as an input to another project, but I don't want the project that creates the stubbed code to fail, because otherwise it's going to compile everytime I build, I only need it to compile when the headers change.

It sounds like your solution would work, but I've just realised I can just run a custom build on the file using cl /P /C, which will not invoke the linker at all, so the project won't fail. Thanks for your advice though.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this