English 中文(简体)
该方案设立了客观的C++,正在坠毁。
原标题:The program created objective c++ is getting crash

我正在开发一个申请,以获取MacOS X 10.5或以上已安装的软件清单。 该方案采用客观标准++(c,c++, obj-c)。 每当我管理该方案时,它都会坠毁。

int main (int argc, const char * argv[])  
{
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];    
     //My part of coding
     [pool drain];  // This is the crash prone place
     return 0; 
}

这里提供项目细节:

档案范围:

编为:目标C++

Objc GC:无支持

使用的图书馆:libxml2.2.dylib, Foundation Framework

具体目标 x86_x64

发展:MacOS X 10.6.8,Xcode 3.2.6

申请类型:假释申请

我不知道需要制定任何其他办法,以汇编客观的C++。 在这方面的任何帮助都值得赞赏。

是的。 我已经将基调定为10.5

记录仪:

The Debugger has exited with status 0. [Session started at 2011-10-03 22:29:25 +0530.] GNU gdb 6.3.50-20050815 (Apple version gdb-1515) (Sat Jan 15 08:33:48 UTC 2011) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "x86_64-apple-darwin".tty /dev/ttys003 Loading program into debugger… Program loaded. run [Switching to process 2973] Running… Program received signal: “EXC_BAD_ACCESS”. sharedlibrary apply-load-rules all (gdb)

I have one more question. Is it valid to release the obj-c object in c++ class destructor? like this

myclass::myclasss() { myobjcinterface* myobjc = [[myobjcinterface alloc] init]; }

我的阶级:~myqu(){[我的释放];}

问题回答

我还有一个问题。 在C++级反应堆中释放切除物体是否有效? ......

是的。

至于您的EXC_BAD_ACCESS,如果它 ha倒了汽车库的流失,那么它几乎肯定你已经自动释放了和<<>m>的物品,因此该集合公司正试图释放一个 d子。

绘制环境变量<代码>NSZombieEnabled至YES,然后管理您的方案。 它应向您提供过度释放的诊断。





相关问题
xcode "compile source as" override for specific file

I have a project that has to be set to "Objective-C++" for the "compile source as" value (no, "according to file type" will not work in my main project). I am having a problem with a file I got from ...

Differences between Objective-C vs. Objective-C 2.0 [closed]

I reserved 2 library books which came on the same day. I saw them on the shelf and realized that they were the same except one was about ObjC and one was about ObjC 2.0. Also, what is the Objective-C+...

Cocoa and Objective-C++

I think I understand how Objective-C++ works in relation to Cocoa, and I am fairly versed in the basics of command-line C++ but sort of afraid to try mixing it with Objective-C. I can create a GUI ...

Track all Objective-C s alloc/allocWithZone/dealloc

Sorry for long description, however the questions aren t so easy... My project written without GC. Recently I found a memory leak that I can t find. I did use new Xcode Analyzer without a result. I ...

Language Mixing: Model and View

Consider developing an application where the model will be written in C++ (with Boost), and the view will be written in Objective-C++ (with Cocoa Touch). Where are some examples showing how to ...