---
title: 选项 -lmathlib
description: "针对同一数学函数，mathlib支持标量及矢量两种实现方式。此选项使能标量mathlib数学库。GCC for openEuler不维护mathlib，使用开源的mathlib库。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengdevkithistory/hgcc/hist-hgcc/kunpenghgcc_06_0032.html
sourcePath: /source/zh/kunpengdevkithistory/hgcc/hist-hgcc/kunpenghgcc_06_0032.html
indexId: 54c5cc710e04b08fd981879801bde7018638f92563367a6e810dd162dbbdc22f71
---
# 选项 -lmathlib

#### 说明

针对同一数学函数，mathlib支持标量及矢量两种实现方式。此选项使能标量mathlib数学库。GCC for openEuler不维护mathlib，使用开源的mathlib库。


#### 使用方法

mathlib依赖于libm，因此使用时，要同时链接libm，且libm的链接顺序必须位于mathlib之后。

选项为-lmathlib -lm。


#### 结果

应用软件编译完成，通过ldd命令检查可执行文件是否成功调用mathlib库，以a.out为例，执行

```
ldd a.out
```

若出现下图红框中的信息，则调用成功；若未出现，则需检查mathlib库的路径是否被加载至系统默认路径。具体配置方式参照上述使用方法。
