iOS - printing memory address using PRIx64 in plCrashReporter
I'm trying to include plCrashReporter in my iPhone app using the code found here:
http://plcrashreport开发者_运维问答er.googlecode.com/svn/tags/plcrashreporter-1.0/Documentation/API/example_usage_iphone.html
My one issue occurs on this line:
NSLog(@"Crashed with signal %@ (code %@, address=0x%" PRIx64 ")", report.signalInfo.name,
report.signalInfo.code, report.signalInfo.address);
with the error:
error: expected `)' before 'PRIx64'
I tried searching around but can't find anything on this. Thoughts? report.signalInfo.address is an 64-bit unsigned int so why don't they just use %u?
Thanks!
PRIx64 is a macro for "X".
@mark is right, but this change is rather intrusive, especially if you expect your code to be reused in other applications. Instead, you should make sure you have defined the following macro (it can be done on the compile line, without modifying your source code):
__STDC_FORMAT_MACROS
For example, your compile line should be something like:
gcc -D__STDC_FORMAT_MACROS foo.c -o foo
精彩评论