This is the first time I have ever used a site like this, but I am significantly stuck. The background section that follows is included for completeness as I am not sure if any of the actions described within it may have contributed to the current problem I am facing.
Background
A colleague and I had written a whole lot of c++ code in a console application (with default settings) in visual studio 2010 (full version) for a university assignment. We decided that we wanted to try our hand at a winforms application and so created one in visual studio 2010 and imported all our code from the console application. We faced the following issues:
- Needed to add our includes in the "stdafx.h" file and then #include "stdafx.h" in all our implementation files (.cpp's).
- In places where we were using c++ strings (std::string), we had to change to managed system strings (System::String^) for CLR compatibility.
- Changed the "Common language runtime support" compile option to /clr instead of /clr:pure. This was needed to solve linking errors (LNK2028, LNK2019) we had with boost::shared_ptr ...
After we had done the above things our project was compiling.
The Problem
When we run the application we get the following assertion failure:
_CrtIsValidHeapPointer(pUserData)
This assertion fails immediately, seemingly without any code being executed, as when I set breakpoints at the start of main they are not reached in debugging (call stack is empty).
The only way I have been able to get the application to run is by setting the CLR option to /clr:pure and removing all usage of boost.
I have 3 questions:
- Is code being executed? I know it sounds impossible that an assertion could be failing without code being executed. Is there something that happens before main perhaps?
- What do the /clr and /clr:pure options really mean?
- Can boost libraries be compiled to clr compatible code? If so, what may cause linking issues?
Thank you all for your time, I have not posted any code because I literally don't know what to post...I have no idea where the issue is occurring. If anyone has suggestions for what code to post, I am open to them.
Regards Brad