C++ NetBeans 链接外部源和 .so 文件
我正在 Linux 中使用 NetBeans 编写 C++ 程序。我很难将其设置为使用外部源/共享对象。我有来自已编译的外部包的 .so 文件及其附带的源文件。
到目前为止,我已经:
- 指定项目包含所有源文件和头文件目录(在“项目属性”->“构建”->“C++ 编译器”下)
- 指定与外部源代码相对应的 .so 文件(在“项目属性”->“C++ 编译器”下 ) ;Build-Linker)
当我尝试声明外部源中定义的对象时,NetBeans 不会给我任何语法错误,甚至会自动为我完成对象名称。但是,当我构建程序时,我收到一条错误消息,指出“对该对象的未定义引用”。
我做错了什么可怕的事情吗?
编辑: 为了回答 quamrana 的问题,这是尝试构建时控制台中的输出行之一。
g++ -o dist/Debug/GNU-Linux-x86/JAUSTester build/Debug/GNU-Linux-x86/MainScreen.o build/Debug/GNU-Linux-x86/main.o build/Debug/GNU-Linux-x86/moc_MainScreen.o -L/usr/lib -Wl,-rpath /usr/local/lib/active /usr/local/lib/active/libcxutils.so -Wl,-rpath /usr/local/lib/active/libjauscore.so -Wl,-rpath /usr/local/lib/active/libjausextras.so -Wl,-rpath /usr/local/lib/active/libjausmobility.so -Wl,-rpath /usr/local/lib/active/libtinyxml.so -lQtGui -lQtCore -lpthread
我想要包含的 .so 文件是 /usr/local/lib/active/ 中指定的文件。
I am writing a C++ program in Linux with NetBeans. I am having difficulty setting it up to use external sources/shared objects. I have the .so files from the compiled external package and the source files that go with it.
So far I have:
- specified for the project to include all the source and header file directories (under Project properties->Build->C++ Compiler)
- specified the .so files that correspond to the external source code (under Project properties->Build-Linker)
When I try to declare an object defined in the external sources NetBeans does not give me any syntax errors and even auto-completes the object name for me. However, when I build the program I get an error saying "undefined reference to" that object.
Am I doing something horribly wrong?
EDIT:
In response to quamrana's question, this is one of the output lines in the console when it attempts to build.
g++ -o dist/Debug/GNU-Linux-x86/JAUSTester build/Debug/GNU-Linux-x86/MainScreen.o build/Debug/GNU-Linux-x86/main.o build/Debug/GNU-Linux-x86/moc_MainScreen.o -L/usr/lib -Wl,-rpath /usr/local/lib/active /usr/local/lib/active/libcxutils.so -Wl,-rpath /usr/local/lib/active/libjauscore.so -Wl,-rpath /usr/local/lib/active/libjausextras.so -Wl,-rpath /usr/local/lib/active/libjausmobility.so -Wl,-rpath /usr/local/lib/active/libtinyxml.so -lQtGui -lQtCore -lpthread
The .so files I want to include are the ones specified there in /usr/local/lib/active/.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论