Solved

can a obj file included with #pragma directive?

Posted on 2004-04-20
8
680 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

744 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

15 Experts available now in Live!

Get 1:1 Help Now