Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

can a obj file included with #pragma directive?

Posted on 2004-04-20
8
Medium Priority
?
744 Views
Last Modified: 2013-11-18
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")
0
Comment
Question by:SteH
  • 4
  • 3
8 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 500 total points
ID: 10866813
Playing with VC++ 7.1 I found that if I add .obj file to the project, linker links it and includes to final executable. You can create different project configurations, some of them with obj file, another without it. To exclude obj file from configuration, set "Excluded from Build" to Yes from file properties.
Not exactly what you want, but may help.
0
 
LVL 13

Author Comment

by:SteH
ID: 10867154
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.
0
 
LVL 13

Author Comment

by:SteH
ID: 10877703
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.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 48

Expert Comment

by:AlexFM
ID: 10877885
>> Selecting another configuration is fast. Only it doubles the needed space on the HD.

Additional configuration is just number of lines in .dsp file.
0
 
LVL 13

Author Comment

by:SteH
ID: 10877934
But the output of it will be stored in a seperate directory. And output with debug and browse information is quite big.
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 10878179
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.
0
 
LVL 13

Author Comment

by:SteH
ID: 10878279
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.
0
 
LVL 1

Expert Comment

by:arkanes
ID: 11091396
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.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

879 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question