Use the C++ compiler to compile the C library

Problem Description

Errors encountered when compiling C library files with C++

/home/fa/chatbot/main.cpp:1321: undefined reference to `get_musicInfo_key(char*, char*)'

Cause Analysis

Because the compiler needs to be informed, C++ needs to tell the system to use the C compiler when linking and compiling C library files.

Solution

Add extern "C" { *** }to inform , the example is as follows:

extern "C"{
#include "lib/mic_ring_buffer.h"
#include "lib/migu.h"
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325389917&siteId=291194637