Solved

can a obj file included with #pragma directive?

Posted on 2004-04-20
8
684 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 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CSS HELP 6 84
computer science syllabus 3 70
Create a path if not exists 7 69
Copy output image from TWindowsMediaPlayer 6 25
This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

863 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now