Get the App
SLTechnology News&Howtos  ›  Development  › 

How does C++ call the written C interface?

Shulou Source: shulou.com Published: 2022-06-03 05:24:47 09月30日 Update

This article mainly introduces how C++ calls the written C interface, which has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, let the editor take you to know it.

1. C++ calls C file

A C language file test.c

# include void print (int a _ line int b) {printf ("what is called here is a C language function:% dline% d\ n", a _ line b);}

A header file test.h

# ifndef _ TEST_H # define _ TEST_H void print (int aline int b); # endif

C++ file calls C function

# include using namespace std; # include "test.h" int main () {cout

Tags: Caching language compilation function file link interface command time symbol article code compiler that is again name underlying way run different Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information OPPO Reno NVidia Apple Xiaomi