Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 其它 > 资料存档
资料存档 资料存档
回复
 
主题工具 显示模式
旧 2019-12-04, 02:55   #1
poster
高级会员
 
注册日期: 2019-11-21
帖子: 3,006
声望力: 66
poster 正向着好的方向发展
默认 使用cmake混合

我正在尝试使用mex从C ++创建MATLAB函数。对于C ++代码,我正在使用CLion。默认情况下,CLion中有一个CMakeLists.txt文件,该文件负责所有链接。当我直接在CLion中运行它时,它可以很好地工作,但是我不知道如何将其用于mex:

arrayProduct.cpp:

#include "mex.h" #include "someFunctions.h" void mexFunction(...){ ... printRandomStuff(); // defined in someFunctions.h resp. someFunctions.cpp ... } CMakeLists.txt:

cmake_minimum_required(VERSION 3.15) project(mex_attempt) set(CMAKE_CXX_STANDARD 14) find_package(Matlab) matlab_add_mex( NAME mex_attempt SRC arrayProduct.cpp someFunctions.h someFunctions.cpp ) 当我在MATLAB中运行mex时,似乎无法理解包含内容。

>> mex /Users/username/CLionProjects/mex_attempt/arrayProduct.cpp Error using mex xcrun: error: SDK "macosx10.14.1" cannot be located Undefined symbols for architecture x86_64: "printRandomStuff()", referenced from: _mexFunction in arrayProduct.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) 这里有什么问题?非常感谢!



更多&回答...
poster 当前离线   回复时引用此帖
回复


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛禁用 表情符号
论坛启用 [IMG] 代码
论坛启用 HTML 代码



所有时间均为北京时间。现在的时间是 23:57


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.