在Xcode上写了些c++代码,想要再写点unittest,从apple developer上找到这个介绍:http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/UnitTesting/1-Articles/CreatingTests.html,无奈这篇09年的文档太过陈旧,Xcode已更新过几次,最新的Xcode已取消了Carbon工程,见这里:http://discussions.apple.com/message.jspa?messageID=12130866
于是,另寻其他途径。
googletest是之前尝试使用过的,于是再找到这里:http://code.google.com/p/googletest/wiki/XcodeGuide。按照这个介绍还是未能成功,Framework添加到target后有问题,对Xcode实在是不熟,没办法,于是再尝试其他方法。
按照最基本的方法,把编译出静态库和.h文件放到工程目录下,再在unittest target里添加-lgtest和-lgtest_main以及.h文件的搜索目录,终于成功。