Hiding classes from ClassView
=?iso-8859-1?Q?Steinar_St=F8lsnes?= -- Steinar.Stolsnes@ttsint.no
Tuesday, September 10, 1996
Environment: Windows 95, VC++ 4.2, MFC 4.2
When I include header files from my library, the classes defined in =
those header files, are shown in the ClassView in the Developer Studio. =
How can I prevent them from being shown, as is done with the standard =
MFC classes, like CView and CDocument ?
Steinar St=F8lsnes
TTS International
Norway
Roger Onslow/Newcastle/Computer Systems Australia/
Wednesday, September 11, 1996
[Mini-digest: 5 responses]
Steinar St=F8lsnes wrote:
>When I include header files from my library,
>the classes defined in those header files,
>are shown in the ClassView in the Developer Studio.
>How can I prevent them from being shown,
>as is done with the standard MFC classes,
>like CView and CDocument ?
Place include file name in the "msvcincl.dat" file in your /Windows direc=
tory
Quick search on MSVC docco revealed the following info
Here is what VC docco has to say:
...
Visual C++ automatically scans the added project files recursively for #i=
nclude=20
directives, both bracketed () and quoted ("incl.h"). It scans bot=
h=20
source files (.C, .CPP, or .CXX) and resource files (.RC or .R), and adds=
all=20
the included files that it finds to a Dependencies folder. The files in t=
his=20
folder can have extensions of .H, .HXX, .INC, .FON, .CUR, .BMP, .ICO, .DL=
G, or=20
.TLB. You cannot directly add or delete the files included in this folder.
Visual C++ also refers to the following two exclusion files:
SYSINCL.DAT This file, which contains a default list of system include =
files,=20
is installed by the setup program on your computer in the directory in wh=
ich=20
you installed Microsoft Developer Studio (MSDEV.EXE).
MSVCINCL.DAT This is a text file that you can create and put in your Wi=
ndows=20
directory. You can list in it additional files that you want to exclude, =
such=20
as headers for external class libraries or some of the include files in a=
large=20
project. You should use this file for additions because SYSINCL.DAT may b=
e=20
overwritten if you reinstall Visual C++, if you modify your installation =
with=20
Setup, or if you update your installation. If you use the Developer Studi=
o text=20
editor to create this file, you must exit Developer Studio and then resta=
rt it=20
for the file to become effective.
These lists should contain only files that are not likely to change often=
.=20
Whenever Visual C++ updates dependencies, it excludes the files in these =
lists=20
from dependency scanning and does not display them in the Dependencies fo=
lder.=20
If you change only files in either of these lists, you must choose Rebuil=
d All=20
from the Build menu in order to build your selected project. If you merel=
y=20
choose Build, the dependency folder has no changes in it, and Visual C++=20
reports that your project is up to date. Alternatively, you could select =
the=20
source files that include the changed dependencies, and choose Compile fr=
om the=20
pop-up menu in order to explicitly build those files. After those files h=
ave=20
been built, choose Build from the Build menu to build the project.
...
Here is what MSDN had to say:
...
Q. How do I prevent classes from being displayed in the ClassView pane of
the Workspace window?
=20
A. To prevent classes from being displayed in the ClassView pane, you nee=
d
to remove the header with the class declarations from the project's
dependency list. To do this, follow these steps:
=20
1. Create a directory in which to relocate the header file(s) that you
want to remove from the dependency list. For example:
=20
mkdir c:\msdev\projects\myproj\inc
=20
2. Move the header files to this new directory.
=20
3. Add this directory to your include search path by using the
Directories page of the Options dialog box invoked by clicking
Options on the Tools menu.
=20
4. Create a text file named Msvcincl.dat, and list the header files yo=
u
want to exclude from the dependencies list. Save this file to your
Windows directory.
=20
5. Close Developer Studio, and delete the project's .ncb file.
=20
6. Restart Developer Studio, and load your project. The classes declar=
ed
in the headers listed in the Msvcincl.dat file should no longer
appear in the ClassView pane.
=20
NOTE: The Msvcincl.dat file must be located in your Windows
directory, and your #include directives must not specify a full
pathname to these headers. Otherwise, these files will remain in th=
e
project's dependencies list.
...
And here is what a KB article says about it:
Keeping #include Files Out of VWB Dependency List
=20
PSS ID Number: Q102390
Article last modified on 05-22-1995
=20
1.00 1.50 | 1.00 2.00 2.10
=20
WINDOWS | WINDOWS NT
=20
=20
-------------------------------------------------------------------------=
-
The information in this article applies to:
=20
- The Visual Workbench included with:
=20
- Microsoft Visual C++ for Windows, versions 1.0, 1.5, 1.51
- Microsoft Visual C++, 32-bit Edition, versions 1.0, 2.0, and 2.1
-------------------------------------------------------------------------=
-
=20
SUMMARY
=3D=3D=3D=3D=3D=3D=3D
=20
By default, the Visual Workbench includes files in the dependency list ev=
en
if they are included between an #ifdef, #endif pair. In some situations,
this behavior may be undesirable. The following article describes several
ways to keep the files out of the dependency scanning process.
=20
MORE INFORMATION
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=20
The Visual Workbench scans a file for header file dependencies by looking
for lines in a source file that have the form
=20
#include
=20
-or-
=20
#include "filename.h"
=20
Because the dependency scanner does not have a preprocessor, it will
include headers file in the dependency list even if they conditionally
included using an #ifdef as shown below.
=20
For example, with the following code, the file "unixstuf.h" will be tagge=
d
as a dependency when the makefile is built:
=20
#define _WIN32
=20
#ifndef _WIN32
#include
#endif
=20
To get the desired behavior:
=20
1. Edit the SYSINCL.DAT file in the Visual C++ for Windows BIN directory
by default, C:\MSVC\BIN), or the Visual C++ 32-bit Edition MSVCINCL.DA=
T
file under the Windows NT directory (by default, c:\WINNT).
=20
The SYSINCL.DAT file is an exclusion file that the Visual Workbench
uses to prevent scanning specified files for dependencies. In its
initial state, SYSINCL.DAT lists the system include files that are
unlikely to change. You can edit this file to prevent Visual Workbench
from scanning other files, such as header files that you know will not
change, or to scan system files that you alter. If you delete the
SYSINCL.DAT file, Visual Workbench restores it to its default state
the next time you start Visual Workbench.
=20
Make any necessary changes to SYSINCL.DAT before you start Visual
Workbench.
=20
2. Include two comment delimiters on the #include line as below.
=20
#include /**/
=20
This construct fools the dependency scanner and it does not include
the file in the dependencies.
=20
3. Use a #define to associate a preprocessor symbol with the header file,
as shown here:
=20
#define SY_SEM_H
=20
#if OS =3D=3D UNIX
#include SY_SEM_H
#endif
=20
-or-
=20
#ifdef UNIX
#define file sys/unixstuf.h
#ifdef DOS
#define file
=20
#include file
=20
Because the dependency scanner cannot resolve preprocessor directives,
it also cannot resolve #defines.
=20
REFERENCES
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=20
For more information about SYSINCL.DAT, choose Visual Workbench from the
Visual Workbench Help menu and choose Search. Type SYSINCL.DAT and choose
OK.
=20
Additional reference words: kbinf 1.00 1.10 1.50 2.00 2.10
KBCategory: kbtool kbfasttip
KBSubcategory: VWBIss
=20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D
=20
Copyright Microsoft Corporation 1995.
=20
Hope this helps:
Roger Onslow
-----From: Mats Haggren
There are two ways:
1. #include /**/ "myincludefile.h", this will hide all classes declared i=
n
myincludefile.h
2. Put the file MSVCINCL.DAT in the Windows directory. In it you list fil=
es
that should be excluded
from the classview.
/Mats
-----From: Alberto Massari
There is a file, SYSINCL.DAT, that contains the header files that ClassVi=
ew
must not examine, and it contains the MFC header files.
MSDEV looks in another file, MSVCINCL.DAT, that is used to contain the
user-defined include files. You have to create it and fill with the
appropriate names.
Bye
Alberto
----------------------------
|\ _,,,--,,_
/,`.-'`' ._ \-;;,_
|,4- ) )_ .;.( `'-'
'---''(_/._)-'(_\_) =20
------------------------------------------------------------------
Alby@MusArt.dist.unige.it is: Alberto Massari
Laboratorio di Informatica Musicale
D.I.S.T. Dipartimento di Informatica, Sistemistica e Telematica
Universita' di Genova
Via all'Opera Pia 13,
I - 16145 Genova ITALIA http://MusArt.dist.unige.it/alby/
------------------------------------------------------------------
-----From: Jim Leavitt
Steinar:
Lifted from FAQ: Visual C++ 4.0 Frequently Asked Questions (its on your =3D
vc4 CD)
Q. How do I prevent classes from being displayed in the ClassView pane =3D
of
the Workspace window?
=3D20
A. To prevent classes from being displayed in the ClassView pane, you =3D
need
to remove the header with the class declarations from the project's
dependency list. To do this, follow these steps:
=3D20
1. Create a directory in which to relocate the header file(s) that =3D
you
want to remove from the dependency list. For example:
=3D20
mkdir c:\msdev\projects\myproj\inc
=3D20
2. Move the header files to this new directory.
=3D20
3. Add this directory to your include search path by using the
Directories page of the Options dialog box invoked by clicking
Options on the Tools menu.
=3D20
4. Create a text file named Msvcincl.dat, and list the header files =3D
you
want to exclude from the dependencies list. Save this file to your
Windows directory.
=3D20
5. Close Developer Studio, and delete the project's .ncb file.
=3D20
6. Restart Developer Studio, and load your project. The classes =3D
declared
in the headers listed in the Msvcincl.dat file should no longer
appear in the ClassView pane.
=3D20
NOTE: The Msvcincl.dat file must be located in your Windows
directory, and your #include directives must not specify a full
pathname to these headers. Otherwise, these files will remain in =3D
the
project's dependencies list.
Jim Leavitt
-----From: Dinesh Jindal
The solution is very simple. Just include the files using following=20
style:
#include /* */ "abcd.h"
The starting '/*' tricks class view to ignore that particular header
file.
Hope it helps.
Note: I have tried it with VC 4.0 and 4.1, it works. I don't know about
4.2.
-Dinesh Jindal
| Вернуться в корень Архива
|