Solved

can a obj file included with #pragma directive?

Posted on 2004-04-20
8
717 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 125 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

695 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