Link to home
Start Free TrialLog in
Avatar of Member_2_1001466
Member_2_1001466

asked on

can a obj file included with #pragma directive?

I am using VC++ 6.0 SP5 on Win XP

I have to different PCI cards which can be used with a project. Both have drivers for VC++but from time to time I am swapping those. In order not to change all the project I made conditional compiles depending on a define for either card. One of the driver provides a lib file with it which can be easily included using
#pragma comment (lib, "file.lib")
But the other driver provides an obj file. using the pragma lib approach gives me an error that the format of he obj file is not correct lib. Quiet reasonable. but can I do the same for this file? Perhaps using something like
#pragma comment (linker, "/include:???file2.obj")
ASKER CERTIFIED SOLUTION
Avatar of AlexFM
AlexFM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Member_2_1001466
Member_2_1001466

ASKER

As you say not exactly what I want. Currently I change the popject options to include the obj file in the linker tab. But to change from one to the other configuration I need to change the project options and the source file not the source files only.

Not usre if I found the solution:
I include the obj file in the project settings. In case it is not needed it seems to be not  included in the build. But yet I have not tested it in the case it is needed (Don't want to swap cards again!)

Can anyone comment on this.
Since there seems to be no other comment I will close the question. And having thought about it a bit your solution can be as easy if not a bit easier. Selecting another configuration is fast. Only it doubles the needed space on the HD. But prices should fall. So when the disk is full I can get a new one.
>> Selecting another configuration is fast. Only it doubles the needed space on the HD.

Additional configuration is just number of lines in .dsp file.
But the output of it will be stored in a seperate directory. And output with debug and browse information is quite big.
Some time ago I worked with real-time programmer, and he suggested me to remove all empty lines from my source code to save space on hard disk. :-)

Seriously: if you want to produce different exe files for different PCI cards from the same project, making configuration for each card is obvious decision. You can add post-build step which removes output of all configurations except current.
My first idea ws to overwrite exe files and temporary files as well. But using configurations as switch will change it to have different directories. But perhaps this could be circumvented somehow. Nevermind I see what can be done. I don't want to dig to deep into it. Hope I don't need to switch cards which is only needed if an external box is not working as expected. And the supplier can test only with the card which I can have only temporarily.
The different directories are only defaults, you can set all the configurations to output to the same directory if you want. That said, unless you're developing on some ridiculously low end machine, I don't see why you'd want to. It's alot of files, sure, but even a really big project shouldn't be more than a few hundred megs, and you could have 50 configurations with plenty of room to spare on a cheap (< $100) hard drive.