RMRL: People:Pooya:Tips You know how sometimes especially when you are not an expert in the field these small utterly stupid problems come up and you need to spend a day finding a 5-min solution for a problem? well, here you can find a collection of the ones I have had to deal with and the solutions. Just in case it could save someone (and myself) some time.. OpenGL and managed exntensions in Visual C++ .Net Synopsis:
'/RTC1' and '/clr' compiler options are incompatible. Without Run-time checking (/RTC1) some openGL functions won't work properly. specifically, for me, GLUquadric and gluNewQuadric would generate runtime errors.
Solution:
Add empty definitions of the problem functions all of the .CPP files in the project, for eg.:
struct gluNewQuadric {};
struct GLUquadric {};
as explained here: http://www.winterdom.com/mcppfaq/archives/000262.html
Details of my specific case:
I was trying to include libraries with managed extensions in PHANToM OpenHaptics programming, where the graphic is based on OpenGL.
If try to use managed extensions (using namespace etc), you might get the following erros:
Command line error D2016 : '/RTC1' and '/clr' command-line options are incompatible
Turn off Run-time checks (/RTC1 option). Find and Replace in the .vcproj file:
Replaced: BasicRuntimeChecks="3"
With: BasicRuntimeChecks="0"
as explain here: http://dotnet247.com/247reference/msgs/48/244642.aspx
another error you might get:
Command line error D2016 : '/YXstdafx.h' and '/clr' command-line options are incompatible
Just turn off pre-compiled headers.
Then the file would compile properly, but I would get the following runtime error:
An unhandled exception of type 'System.TypeLoadException' occurred in XXX.exe
Additional information: Could not load type GLUquadric from assembly XXX, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
Solution as above.
|