品牌中未定义的参考 [英] Undefined reference in make

查看:110
本文介绍了品牌中未定义的参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编译包含许多文件的代码,其中一些位于本地MATLAB安装文件夹中.为此,我在g ++中添加了一个include,显然它不能很好地解决,因为我得到了所有MATLAB-C ++函数的未定义引用(我正在尝试使用MATLAB C ++ Engine),在以下屏幕截图中显示:

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:

Makefile非常短,因此:

The Makefile is very short and as such:

我已经检查了引用目录,它确实包含了 constraints.cpp 引用的"Engine.h",通常足以执行MATLAB-C ++引擎功能.

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.

关于此问题可能来自何处的任何想法?

推荐答案

您需要与MATLIB库文件链接.您的代码正在引用它们,但是链接器不知道它们是什么.

You need to link with the MATLIB library files. Your code is referencing them, but the linker doesn't know what they are.

这篇关于品牌中未定义的参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆