Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics
 

sample run error(VC2008)

sample run error(VC2008)
lanhan 2012/06/30 10:42
---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Assertion Failed!

Program: c:\OpenCASCADE6.5.3\samples\mfc\win32\vc9\bind\Geometry.exe
File: c:\opencascade6.5.3\samples\mfc\common\winmain.cpp
Line: 76

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.

(Press Retry to debug the application)
---------------------------
中止(A) 重试(R) 忽略(I)
---------------------------
lanhan 2012/06/30 10:45
here pApp is NULL:

CWinApp* pApp = AfxGetApp();

MFC:
int AFXAPI AfxWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
     LPTSTR lpCmdLine, int nCmdShow)
{
#ifdef DISPLAYCONSOLE

// Redirection of standard output to console
int hCrt; BOOL rep; FILE *hf;
_SYSTEM_INFO lps;
GetSystemInfo(&lps);
rep = AllocConsole();
hCrt = _open_osfhandle((long) GetStdHandle(STD_OUTPUT_HANDLE),_O_TEXT);
hf = _fdopen( hCrt, "w" );
*stdout = *hf;
// stop the buffer on stdout
// int i = setvbuf( stdout, NULL, _IONBF, 0 );
// filebuf ff(hCrt);
// cout = &ff;
cout<<"This Debug Window is defined in WinMain.cpp and will disappear in release mode"<<endl;

#endif // DISPLAYCONSOLE // By Matra

// create log file for all OCC messages
// Message::DefaultMessenger()->AddPrinter (new Message_PrinterOStream ("OCCSampleRun.log", Standard_False));

ASSERT(hPrevInstance == NULL);

int nReturnCode = -1;
CWinApp* pApp = AfxGetApp();
// error here:pApp=NULL
Forum supervisor 2012/07/02 10:09
Dear lanhan,
The problem is not reproduced as in Debug as in Release mode.
'Geometry' sample starts and works properly.
Check, please building process once again (see for details 'readme.txt' file in root directory of
'mfc' based samples). Also I suggest you to check the built sample with Dependency Walker.
Regards
Andrew Hall 2013/06/12 13:22
I have also just had this issue, release built apps work, but debug built apps generate a failure to generate cwinapp error. I fixed this my running the msvc.bat vc9 win32 Debug first to set up the environment variables first before visual studio and then you can build one of the sample apps (I used modeling) and run it in debug mode.

Is there any way to setup the variables so you can build/run debug or release in developer studio without having to reset the environment variables and restart visual studio ?
Philippe Carret 2014/03/19 13:26
OCC6.7.0
I have excactly the same problem.
Sample can run in Release mode.
I think it comes from Debug Window (Console)

For a better use and stability in packages, here are 2 proposals :

1) Do not change OCC tree organisation anymore

It surely work on OCC Developer machine because everything is correctly set
all changes in OCC tree structure does not help :
old "ros" folder name
3rdparty to each lib folder

2) Suppress Environment Variable use

all setup with environnent variables is a headache because we do have current production version (6.2.0) and we want to test new version (6.7.0)
For each change with envvar you need a DevStudio restart
I've tried the .bat with no success


I'm sure it's pretty hard for OCC team because OCC is cross-platform, but it does not help us to follow the release seamlessly


Even though, thanks for your great work
 
 
Latest news
  • New features to enhance the development process
  • Open CASCADE Technology 6.7.1 is available for download!
  • Open CASCADE Technology 6.7.0 is available for download!

  • © OPEN CASCADE 2000 - 2014  |  Search  |  Contacts   |  Site map