LNK2019 unresolved external symbol when using vector

13 views (last 30 days)
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!!

Answers (1)

Walter Roberson
Walter Roberson on 27 Nov 2015

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

Categories

Find more on Write C Functions Callable from MATLAB (MEX Files) in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!