我使用printf语句进行简单的调试。没有格式字符串的printf可以正常工作,但是,如果我使用格式字符串尝试打印一个值,它不会显示在xcode的调试器控制台中。
#include <stdio.h>
DLLExport MACPASCAL void PluginMain(const int16 selector,
FilterRecordPtr filterRecord,
intptr_t * data,
int16 * result) {
printf("hello world\n"); //shows up in console
printf("hi number %i\n", 5);//does not show up in console
....
}
我正在调试,让Xcode启动photoshop,然后从photoshop的菜单运行我的插件。如果我直接从终端执行“gdb Photoshop”,格式字符串printf就可以了。另外,我用Xcode编写了一个简单的独立helloworld程序,格式化字符串在那里也可以正常工作。所以很明显,这与插件的一部分有关,但很奇怪的是,普通printf可以工作,而格式字符串printf不能。
有什么线索吗?