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.
我有一个objective - c++应用程序,它包含一个c++主文件和ObjC头文件。
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/rcOsirix.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.
“有一个。在ObjC类文件中包含了目标(检查)和#导入。
Any help is greatly appreciated.
非常感谢您的帮助。
ObjC++ constantly gives me a headache.
ObjC++经常让我头疼。
Thanks,
谢谢,
-S!
- s !
2 个解决方案
#1
5
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?
显然AppController类已经丢失。AppController类是在动态库的框架中定义的吗?如果是的话,当你运行应用程序时,它知道在哪里找到库/框架吗?
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.
顺便说一下,这是一个链接问题。头文件是不相关的。它是你需要查看的.m或.mm文件。
#2
1
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.
我不确定这是不是您的问题,但是我在c++ dll中遇到了类似的问题,我花了一整天时间调试。我已经有15年没有使用c++编程了,在尝试编写纯虚函数时,我使用了熟悉的语法“virtual void f()”;——哦。在c++中,它应该是“虚空f() = 0;”mac OSX 10.9.2上最新版本的gcc愉快地编译代码。
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.
我认为这是一个完全合法的远期声明……但是,不确定c++是否允许类跨多个文件,因此似乎应该标记它(因为在CXX文件中从来没有提供任何实现)。在任何情况下,符号都将它放入对象代码中,而链接器从不报错,因此您最终会得到丢失的引用。希望这可以帮助别人。
#1
5
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?
显然AppController类已经丢失。AppController类是在动态库的框架中定义的吗?如果是的话,当你运行应用程序时,它知道在哪里找到库/框架吗?
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.
顺便说一下,这是一个链接问题。头文件是不相关的。它是你需要查看的.m或.mm文件。
#2
1
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.
我不确定这是不是您的问题,但是我在c++ dll中遇到了类似的问题,我花了一整天时间调试。我已经有15年没有使用c++编程了,在尝试编写纯虚函数时,我使用了熟悉的语法“virtual void f()”;——哦。在c++中,它应该是“虚空f() = 0;”mac OSX 10.9.2上最新版本的gcc愉快地编译代码。
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.
我认为这是一个完全合法的远期声明……但是,不确定c++是否允许类跨多个文件,因此似乎应该标记它(因为在CXX文件中从来没有提供任何实现)。在任何情况下,符号都将它放入对象代码中,而链接器从不报错,因此您最终会得到丢失的引用。希望这可以帮助别人。