Aspect_GraphicDeviceDefinitionError from MFC sample

Hi,

I am trying to run the mfc samples in debug, but when I try to run in Debug I get the following
Aspect_GraphicDeviceDefinitionError:

'Geometry.exe': Loaded 'C:\test\OpenCASCADE6.5.0\ros\win32\vc9\bind\TKOpenGl.dll', Binary was not built with debug information.
'Geometry.exe': Loaded 'C:\WINDOWS\system32\opengl32.dll'
'Geometry.exe': Loaded 'C:\WINDOWS\system32\glu32.dll'
'Geometry.exe': Loaded 'C:\WINDOWS\system32\ddraw.dll'
'Geometry.exe': Loaded 'C:\WINDOWS\system32\dciman32.dll'
'Geometry.exe': Unloaded 'C:\test\OpenCASCADE6.5.0\ros\win32\vc9\bind\TKOpenGl.dll'
'Geometry.exe': Unloaded 'C:\WINDOWS\system32\opengl32.dll'
'Geometry.exe': Unloaded 'C:\WINDOWS\system32\ddraw.dll'
'Geometry.exe': Unloaded 'C:\WINDOWS\system32\dciman32.dll'
'Geometry.exe': Unloaded 'C:\WINDOWS\system32\glu32.dll'
First-chance exception at 0x7c812afb in Geometry.exe: Microsoft C++ exception: Aspect_GraphicDeviceDefinitionError at memory location 0x0012fb94..
'Geometry.exe': Loaded 'C:\WINDOWS\system32\MSCTF.dll'
'Geometry.exe': Loaded 'C:\Program Files\MLI\MLS Agent\mlwh.dll', Binary was not built with debug information.
'Geometry.exe': Loaded 'C:\WINDOWS\system32\MSCTFIME.IME'
The thread 'Win32 Thread' (0xf10) has exited with code 1 (0x1).
MFCSAMPLEDLL.DLL Terminating!
Detected memory leaks!
Dumping objects ->
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {968} normal block at 0x04725DE0, 81 bytes long.
Data: 3C 4E A4 78 36 00 00 00 40 00 00 00 01 00 00 00
Object dump complete.
The program '[4012] Geometry.exe: Native' has exited with code 1 (0x1).

I start out running: Run_MSVC.bat vc9 win32 Debug

I have modified the following:

In samples\mfc\env.bat:
Before: IF NOT EXIST "%CASROOT%\%OS_TYPE%\%VCVER%\bin\TKernel.dll" GOTO ERR_CASCADE
After: IF NOT EXIST "%CASROOT%\%OS_TYPE%\%VCVER%\bind\TKernel.dll" GOTO ERR_CASCADE

In ros\env.bat:
Before: set "CSF_GraphicShr=TKOpenGl.dll"
After: set "CSF_GraphicShr=%CASROOT%\win32\vc9\bind\TKOpenGl.dll"

in ros\env_build.bat
Before:
set CSF_DEFINES=HAVE_TBB;HAVE_FREEIMAGE;HAVE_GL2PS

rem Modify the line below according to actual location of the third-party
rem components installed with headers and lib files; also check the following
rem settings. By default third-party tools are expected to be unpacked
rem to subfolder 3rdparty from pre-built packages distributed with OCCT

set "PRODUCTS_PATH=%~dp0..\3rdparty"

set "TCLHOME=%PRODUCTS_PATH%\tcltk-85-%ARCH%"
set "QTDIR=%PRODUCTS_PATH%\qt462-%VCVER%-%ARCH%"
set "FTDIR=%PRODUCTS_PATH%\freetype-2.3.7-%VCVER%-%ARCH%"
set "FTGLDIR=%PRODUCTS_PATH%\ftgl-2.1.2-%VCVER%-%ARCH%"
set "GL2PSDIR=%PRODUCTS_PATH%\gl2ps-1.3.5-%VCVER%-%ARCH%"
set "FREEIMAGEDIR=%PRODUCTS_PATH%\freeimage-%VCVER%-%ARCH%"

set "TBBDIR=%PRODUCTS_PATH%\tbb30_018oss"
set "TBBBIN=%TBBDIR%\bin\%TBBARCH%\%VCVER%"

After:
set CSF_DEFINES=;

rem Modify the line below according to actual location of the third-party
rem components installed with headers and lib files; also check the following
rem settings. By default third-party tools are expected to be unpacked
rem to subfolder 3rdparty from pre-built packages distributed with OCCT

set "PRODUCTS_PATH=%~dp0..\3rdparty\win32"

set "TCLHOME=%PRODUCTS_PATH%\tcltk"
set "QTDIR=%PRODUCTS_PATH%\qt"
set "FTDIR=%PRODUCTS_PATH%\freetype-2.3.7"
set "FTGLDIR=%PRODUCTS_PATH%\ftgl-2.1.2"
set "GL2PSDIR=%PRODUCTS_PATH%\gl2ps"
set "FREEIMAGEDIR=%PRODUCTS_PATH%\freeimage"

set "TBBDIR=%PRODUCTS_PATH%\tbb"
set "TBBBIN=%TBBDIR%\bin"

The odd thing is I had it working on a Friday, and on Monday it doesn't work again. Not sure what the issue is...

Thank you,

William

zjulpj's picture

I got the same error for 6.5.2 when I tried to run the mfc sample. I made similiar changes and opened the solution with the command line:
Run_MSVC.bat vc10 win32 Debug

My CPU: Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz 2.30GHz
My OS is 64bit Win7

William - have your issue addressed already? could you please share your solution? Thanks.
Otherwise, does anyone know the root cause, solution or workaround?

Thank you,
Liu

Forum supervisor's picture

Dear zjulpj,
By default OCCT is built with next options: vc8 win32 Release.
So, if you want simply launch any sample just use this options, for example:
>> RUN.bat vc8 win32 Release ImportExport

If want to use a mode different from default you should first build 3dparty products and OCCT using the chosen mode. See for details chapters " Compilation of third-party products used for OCCT/ Recommendations for compilation" and "Building Modules".
And only after that go to building samples in the specified mode.
Regards

zjulpj's picture

Thank you so much for your quick response, but it is a pity that I didn't have a vc8 installed in my computer.
However, I did have built tcktk8.5, freetype2.3.7 and ftgl2.1.2 with vc10 for 32bit debug mode already before I built OCC and the samples.
I will check it again tomorrow.

Comme le vent's picture

I had the same error and it occurs in tkopengl.dll. It's because ftgl_dnyamic_MTD_d.dll is not found. Maybe update your PATH or put it in the exe directory.

Tkopengl will load the debug dll name of ftgl regardless of debug or release btw.

zjulpj's picture

Hmm, you are correct. It works to copy the ftgl_dynamic_MT_d.dll. Thanks a lot.