when i selected an edge or a face ,an exception occurs

I have installed OCC6.5.1,a exception puzzled me for a few days.
1. In the project Viewer3d,I have created a box,but the exception will occur when the cursor meets with the box.The exception is "Viewer3d.exe in 0x0aa6244b at the unhandled exception: 0xC0000005: read access violation occurs when the location 0x00000000".
2. The same exception also occured in my own program which everything works well under OpenCASCADE 6.3.
3. The enviroment variables I have setted are:
VCVER=vc8
OS_TYPE=win32
CASROOT=C:\OpenCASCADE6.5.1\ros
Add to path:
%CASROOT%\win32\vc8\bin;%CASROOT%\..\3rdparty\win32\tcltk\bin;%CASROOT%\..\3rdparty\win32\tbb\bin;%CASROOT%\..\3rdparty\win32\gl2ps\bin;%CASROOT%\..\3rdparty\win32\ftgl\bin;%CASROOT%\..\3rdparty\win32\freeimage\bin;
CSF_LANGUAGE=us
MMGT_CLEAR=1
CSF_EXCEPTION_PROMPT=1
CSF_MDTVFontDirectory=%CASROOT%\src\FontMFT
CSF_MDTVTexturesDirectory=%CASROOT%\src\Textures
CSF_UnitsDefinition=%CASROOT%\src\UnitsAPI\Units.dat
CSF_UnitsLexicon=%CASROOT%\src\UnitsAPI\Lexi_Expr.dat
CSF_SHMessage=%CASROOT%\src\SHMessage
CSF_XSMessage=%CASROOT%\src\XSMessage
CSF_StandardDefaults=%CASROOT%\src\StdResource
CSF_PluginDefaults=%CASROOT%\src\StdResource
CSF_XCAFDefaults=%CASROOT%\src\StdResource
CSF_GraphicShr=%CASROOT%\win32\vc8\bin\TKOpenGl.dll
CSF_IGESDefaults=%CASROOT%\src\XSTEPResource
CSF_STEPDefaults=%CASROOT%\src\XSTEPResource
CSF_MIGRATION_TYPES=%CASROOT%\src\StdResource\MigrationSheet.txt

Forum supervisor's picture

Dear liyuqing,
I checked the original version of the Viewer3d sample.
The problem is not reproduced.
The next command line was used to start sample:
Run.bat vc8 win32 Release Viewer3d
Probably the reason may be in your modifications of the sample.
Regards

Forum supervisor's picture

See in addition the attached picture.

Attachments: 
lyq3278's picture

dear Forum supervisor:
I don't modify the mfcsample.

lyq3278's picture

These samples can be run successfully only under release mode?
I run viewer3d under debug mode and selecting the vertex without problems.
Are the Variables i setted correct,or there are some necessary variables i have forgeted?
Thank you !

Forum supervisor's picture

Dear liyuqing,
Standard OCCT delivery includes libraries only for release mode.
You can check it revising, for example, PATH variable.
It refers to sub-folders named as "...\bin".
For debug mode is used (by default) "...\bind" sub-folder.
You may use Dependency Walker to check your application.
Regards