On 19/03/2013 at 04:19, xxxxxxxx wrote:
Cinema 4D Version: R14
Platform: Windows ;
Language(s) : C++ ;
I'm trying to setup the debugger as per the docs, but I keep getting the following error when I hit the 'play' button:
Unable to start program 'C:\Program Files\MAXON\CINEMA 4D R14\resource\_api_lib\_api_Win32_Debug.lib'
The specified file is an unrecognised or unsupported binary format.
I have ..\..\Cinema 4D.exe in the command field of the debugging properties of the project.
What's causing this?
On 19/03/2013 at 22:50, xxxxxxxx wrote:
i guess your api project in visual studio is selected as startup projekt. You need to select your plugin project (rightclick "Set as startup project" or sth. like this)
On 19/03/2013 at 22:59, xxxxxxxx wrote:
Ahh, thanks affa.
I do have multiple projects in the one solution, but hadn't thought of that. Cheers.
On 04/04/2013 at 05:28, xxxxxxxx wrote:
I've been playing around with the debug mode in VS Express for the past week/two weeks but I'm not really getting much use from it. I've watched some general C++ debugging vids and done some searches and while I feel I get the gist of it, I'm not really able to apply it effectively to my own c4d-based plugins. Is there a C4D specific tut on this somewhere?
My plugin is several 10's of thousands of lines long and it's getting to be quite difficult to debug using the GePrint method. And while the GePrint way might print errors if something is NULL (for example a value) it doesn't help to explain what causes other issues (such as a memory leak somewhere else in the code that causes a crash). The auto-generated C4D error report doesn't makes any sense to me.
Is there anything I can do to give myself a boost here?
On 04/04/2013 at 08:57, xxxxxxxx wrote:
Do you run C4D using c4d_debug.txt in main folder or "-debug" as a parameter ?
This help to find most of memory leaks. At least if you only use C4D memory allocator.
Finding dereferencing of NULL/nullptr pointers it probably the easiest that can be done in debug mode.
But this should also be possible if you read _BugReport.txt.
The first Call_Stacks contain this usually.
On 04/04/2013 at 18:47, xxxxxxxx wrote:
I had created a c4d_debug.txt file and placed it into the plugin folder. But it's always empty. I placed a copy into the folder where the C4D executables are, but that is always empty too.
The crash shows as an access violation error in Cinema. But the only thing I've been working on at the time this started happening was an objects position and rotation. The object code should only be called when a button is pushed by the user. I can't see how that would cause Cinema to crash before the object is even added to the scene?
This is where I find things difficult to debug as it must be code elsewhere that's causing my problem. Re the Call_Stacks - the first line showing is ???:00000000. Does that mean anything?
On 04/04/2013 at 19:05, xxxxxxxx wrote:
Well, I've managed to stop the crashing. Commenting out a line BaseObject::Free(obj) has stopped it. But doesn't that mean now I have a potential memory leak given the object is now not freed?
This programming business isn't very friendly to the stupid =D
UPDATE: I've commented out a whole lot of BaseObject::Free lines and I no longer get any crashes. Nothing is being printed to the cmd console or any other errors showing... I'm guessing that means I'm leak-free at the moment?!!!
On 05/04/2013 at 03:59, xxxxxxxx wrote:
c4d_debug.txt will be always empty.
C4D does not write anything to it, you just should see the "DOS" console for debuging.
Probably it is just better to stat C4D with "-debug" switch it has the same effect as c4d_debug.txt.
In my opinion just do not call Free(), delete or any other memory deallocation function manually.
Always use Smart Pointers like AutoFree, AutoGeFree... for almost everything.
The only thing that you will need to remember is that if you give the object to C4D then you need to Release() it.