LNK2019 unresolved external symbol when using vector

14 次查看(过去 30 天)
I am creating an s-function for MATLAB/Simulink that is coded in C++. When I attempt to generate the executable from MATLAB using the mex command I get a linker error:
heatTran1D_convWalls_sfun.obj : error LNK2019: unresolved external symbol "class std::vector > ...
The Microsoft C++ 2010 compiler is being used. I am using the vector class within the code in numerous places. The following lines are included at the top of my source file:
#define S_FUNCTION_NAME heatTran1D_convWalls_sfun
#define S_FUNCTION_LEVEL 2
#include "simstruc.h"
#include <math.h>
#include <vector>
using namespace std;
Is it correct that this error indicates that the library containing the vector class cannot be found. If so what library contains the vector class in it and where might I find it on my computer so that I can provide MATLAB with it's location in the mex command. If this is not the issue please let me know your thoughts on what might be the problem and how to resolve it.
Thanks in advance!!

回答(1 个)

Walter Roberson
Walter Roberson 2015-11-27

It looks to me as if you need MSVCPRT.LIB but I am not positive. See https://support.microsoft.com/en-us/kb/154419

类别

Help CenterFile Exchange 中查找有关 Write C Functions Callable from MATLAB (MEX Files) 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by