大佬教程收集整理的这篇文章主要介绍了mac OSX 上的简单动态链接库链接器错误,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我从这个源代码编译了名为“NewProject.dylib”的动态链接库。
//
// source.hpp
// NewProject - Dynamic library
//
//
#ifndef source_hpp
#define source_hpp
#include <stdio.h>
int greatest_common_divisor(int x,int y) {
int r,tmp;
if(x < y){
tmp = x;
x = y;
y = tmp;
}
r= x % y;
while(r != 0){
x = y;
y = r;
r = x % y;
}
return y;
}
#endif /* source_hpp */
然后我做了 test.cpp
#include <iostream>
int greatest_common_divisor(int x,int y);
int main() {
greatest_common_divisor(1,2);
std::cout << "Hello Test!\n";
return 0;
}
尝试编译
g++ -o test test.cpp -L ./ -INewProject
Undefined symbols for architecture x86_64:
"greatest_common_divisor(int,int)",referenced from:
_main in test-90ee6f.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command Failed with exit code 1 (use -v to see invocation)
我认为这是因为导入库无法正常工作。
但是我应该在哪里修复???
通常,名称应该是 lib***.so ???我从 juce
框架制作了动态库。
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
以上是大佬教程为你收集整理的mac OSX 上的简单动态链接库链接器错误全部内容,希望文章能够帮你解决mac OSX 上的简单动态链接库链接器错误所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。