MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   使用cmake混合 (https://www.labfans.com/bbs/showthread.php?t=22381)

poster 2019-12-04 02:55

使用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) 这里有什么问题?非常感谢!



[url=https://stackoverflow.com/q/59163437]更多&回答...[/url]


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

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