PDA

View Full Version : SDK DebugPrint


RustyKnight
10-09-2007, 03:15 AM
I'm just starting to experiment with the SDK and I was wondering where does "DebugCommand ( _T("This is a message") );" go?

Does it get printed to the debug console?
Does it get printed to a log file?
Where is the log file?!
I'm I using this command wrong?!

Cheers
Shane

scorpion007
10-09-2007, 04:05 AM
As the docs state, the output of DebugPrint goes to the output window of Visual Studio while you are debugging.

Are you not seeing it?

RustyKnight
10-09-2007, 04:21 AM
As the docs state, the output of DebugPrint goes to the output window of Visual Studio while you are debugging.

Sorry, I was reading the API entry, not the "how-to" section :P

Are you not seeing it?
Nope, I;m getting...

"'3dsmax.exe': Loaded 'F:\Program Files\Autodesk\3ds Max 9\3dsmax.exe', No symbols loaded."

messages and the like, but not my debug messages...

I have the output set to "debug", which I assume is correct...

Cheers
Shane

scorpion007
10-09-2007, 05:38 AM
That's rather strange.

Yes, "Debug" output is correct. Perhaps you are just overlooking your printout as it is being obscured by the many system diagnostics?

Try a Ctrl-F search in the output window for your print string, or perhaps even set a break point at where you print and step through it line by line and see if you get the output you expect.

EDIT: I tried a simple test using VC8 Pro, Max9 SDK, works fine for me.

RustyKnight
10-09-2007, 05:43 AM
Hi scorpion007!

I could be overlooking a lot of things. I did notice in the other sample code, that I don't need the "_T()" macro and I should append a "\n" to the end, but so far they don't appear to have output any messages.

I appriciate your feedback and will keep on trying

Thanks
Shane

scorpion007
10-09-2007, 05:59 AM
I could be overlooking a lot of things. I did notice in the other sample code, that I don't need the "_T()" macro and I should append a "\n" to the end, but so far they don't appear to have output any messages.

The reason you dont "need" the _T macro is because max does not yet support anything other than ANSI and MBCS. I.e. it doesn't support Wide characters. Yet. That is why your code compiles. The DebugPrint function, and almost all functions that accept strings, ask for TCHAR */LPTSTR types. As soon as max implements unicode versions of DebugPrint and other string functions, your code will break.

When you compile for unicode, TCHAR will expand to wchar_t, and you are passing a narrow string literal "ABC". If you correctly used _T("ABC"), the preprocessor would expand that to L"ABC" and the code would compile fine.

The fact that your code compiles *now* is a consequence of no wide character support. If you want to keep it somewhat future-proof, it's best to use _T(). There is no performance hit in doing so.

Anyway, I'm not sure what could be the cause of it not showing up in the output window.
Perhaps you could make a minimal sample project that I could build and tell you if it works on my machine...

Wierd.


I appriciate your feedback and will keep on trying


No worries, hope it works out for you.


EDIT: BTW, a small tip for VC++. In the debug output window, right click and uncheck "Module Load/Unload" that will suppress all of the messages of DLLs being loaded into max, and just show you the stuff you're interested in (Program output, mainly).

RustyKnight
10-09-2007, 07:40 AM
The reason you dont "need" the _T macro is because max does not yet support anything other than ANSI and MBCS. I.e. it doesn't support Wide characters. Yet. That is why your code compiles. The DebugPrint function, and almost all functions that accept strings, ask for TCHAR */LPTSTR types. As soon as max implements unicode versions of DebugPrint and other string functions, your code will break.

When you compile for unicode, TCHAR will expand to wchar_t, and you are passing a narrow string literal "ABC". If you correctly used _T("ABC"), the preprocessor would expand that to L"ABC" and the code would compile fine.

The fact that your code compiles *now* is a consequence of no wide character support. If you want to keep it somewhat future-proof, it's best to use _T(). There is no performance hit in doing so.
Yep, just read that section of the docks, that's why I was using it...


Anyway, I'm not sure what could be the cause of it not showing up in the output window.
Perhaps you could make a minimal sample project that I could build and tell you if it works on my machine...

Wierd.

The reason is...I'm an idiot...

I was playing around with the CUITest plugin on my desktop at work, when I had to move to monitor some other work, so I thought I would grab my laptop and continue my work with that...probelm is, I forgot to set up the output paths (or as I have done, the post build script) to copy the newly compiled version to my plugins folder...hence, I was running an old build...idiot...

I mean, you meet some people and you think, "they just shouldn't be aloud to use a computer"...problem is, I think I just joined that group :P lol...


EDIT: BTW, a small tip for VC++. In the debug output window, right click and uncheck "Module Load/Unload" that will suppress all of the messages of DLLs being loaded into max, and just show you the stuff you're interested in (Program output, mainly).
Hay, there's a tip worth having!

Again, thanks, the points have been worth it!

scorpion007
10-09-2007, 09:36 AM
Ah, glad to hear it all worked out :)

CGTalk Moderation
10-09-2007, 09:36 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.