1. 程式人生 > 其它 >GCC編譯鏈遇到的問題,ndefined reference to `crypt‘,ndefined reference to `crypt‘,ndefined reference to `crypt

GCC編譯鏈遇到的問題,ndefined reference to `crypt‘,ndefined reference to `crypt‘,ndefined reference to `crypt

技術標籤:cordova

先把指令給出來
[email protected] test_led.c -o test_led -L lib -l wiringPi -l pthread -l crypt -lm -lrt

在linux下編譯時提示:

/usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/9/…/…/…/…/lib/libwiringPi.so: undefined reference to crypt' /usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/9/../../../../lib/libwiringPi.so: ndefined reference to

crypt’
/usr/bin/ld: /usr/lib/gcc/aarch64-linux-gnu/9/…/…/…/…/lib/libwiringPi.so: ndefined reference to `crypt’
典型缺少編譯鏈
那麼在編譯命令時候帶上這些缺少庫檔案頭就可以了

[email protected] test_led.c -o test_led -L lib -l wiringPi -l pthread -l crypt -lm -lrt -l是大L的小

下面是編譯的程式碼
在這裡插入圖片描述

#include <wiringPi.h>
#include <stdio.h>
#define VOICE 3

int main(void)//呼叫LED的函式 warn()
{
	//int VOICE = 3;
	wiringPiSetup();
	pinMode(VOICE, OUTPUT);
	for (int i = 1; i <= 6; i++) {
		digitalWrite(VOICE, HIGH);
		// 啟用
		delay(500);
		// 毫秒
		digitalWrite(VOICE, LOW);
		// 關
		delay(1000);
	}
	return 0;
}