Cg debugging?

Started by
13 comments, last by mlt 15 years, 5 months ago
No clue. The above code is from a file: cg_program that our teacher has given us an we are actually not meant to make any changes to that file (others have used it before without any errors). Its just happens that it is in this file that I keep getting errors.

I don't understand this:

std::cout << (lastListing == 0 ? "No error." : lastListing) << std::endl;


If lastListing == 0 it prints "No error", but earlier you wrote that if lastListing == 0 it was a bad thing (crash with an access violation). I have tried:

std::cout << (lastListing == 0 ? lastListing : "No error.") << std::endl;

but then it crashes as before.



EDIT: I know changed OUT.Color... to OUT.color as you recommended and now I don't get the error anymore. But I still don't see how I could get info about that kind of error.
Advertisement
PM me your msn and i'll have a real-time look if you want.

Or skype.

Preferably skype.
Problem solved, as you can see from the above message.

But I still don't understand how I am able to find this kind of errors in the future (Errors like: OUT.color instead of OUT.Color).
Neither:

(1)
std::cout << (lastListing == 0 ? "No error." : lastListing) << std::endl;


or:


(2)
CGerror error;const char* errorString = cgGetLastErrorString( &error );std::cout << errorString << std::endl;


gives any info. Actually the (2) just makes the program crash when I run it. Seems that its not possible to print a charpointer at runtime.
Just running the Cg compiler on the .cg file gives me all the info I need:

cgc test.cg

So I can't see the need to use the build in routines for error checking.

This topic is closed to new replies.

Advertisement