问题
I'm compiling a code with many files and some are located in the local MATLAB installation folder. For this I've added an include to g++ which apparently doesn't resolve well because I get an undefined reference to for all MATLAB-C++ functions (I'm trying to use the MATLAB C++ Engine) as shown in the following screenshot:
The Makefile is very short and as such:
I've checked the referenced directory and it does include the "Engine.h" referenced by constraints.cpp which is generally enough to execute the MATLAB-C++ engine functions.
Any ideas as to where this problem could come from?
回答1:
You need to link with the MATLIB library files. Your code is referencing them, but the linker doesn't know what they are.
来源:https://stackoverflow.com/questions/35593792/undefined-reference-in-make