开发者

Symbol Not Found, expected in Flat Namespace ObjC++

I've got probably what is a simple problem, but there's no informative errors or warnings during compile to alert me to what is going wrong.

I've got a Objective-C++ app that includes a C++ main and ObjC header files.

It builds fine, but when run, it gives this error message:

Dyld Error Message:
  Symbol not found: _OBJC_CLASS_$_AppController
  Referenced from: /Users/slate/Documents/osirixplugins/eqOsirix/build/Development/rcOsirix.app/Contents/MacOS/rcOsirix
  Expected in: flat namespace
 in /Users/slate/Documents/osirixplugins/eqOsirix/build/Development/r开发者_开发技巧cOsirix.app/Contents/MacOS/rcOsirix

No amount of googling has resulted in a solution, and I'm sure I've just missed a compilation or build option somewhere.

"AppController.h" is included in the target (checked), and #import'd in the ObjC Class File.

Any help is greatly appreciated.

ObjC++ constantly gives me a headache.

Thanks,

-S!


Clearly the AppController class is missing. Is the AppController class defined in a framework of dynamic library? If so, when you run the app, does it know where to find the libraries/frameworks?

This is a linker issue, by the way. The header files are irrelevant. It's the .m or .mm files you need to look at.


Not sure if this is your issue, but I was having a similar problem with a C++ dll, which took me all day to debug. I haven't programmed in C++ for around 15 years, and while attempting to write a pure virtual function, I used the familiar syntax "virtual void f();" -- oops. In C++ it should be "virtual void f() == 0;" The latest version of gcc on mac OSX 10.9.2 happily compiles the code.

I think it's a perfectly legal forward declaration... however, not sure if C++ allows classes to span multiple files, so it seems like this should be flagged (as no implementation is ever supplied in the CXX file.) In any event, the symbol makes it into the object code, and the linker never complains, so you end up with the missing reference. Hope this helps someone.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜