我有一个用C++编写的外部库,比如
external.h
#ifndef OUTPUT_FROM_CPP_H
#define OUTPUT_FROM_CPP_H
#include <cstdint>
extern "C" uint8_t myCppFunction(uint8_t n);
#endif
external.cpp
#include "external.h"
uint8_t myCppFunction(uint8_t n)
{
return n;
}
目前我别无 Select ,只能在我当前的C项目中使用这个C++库.但我的编译器告诉我
No such file or director #include <cstdint>
在我的C项目中使用时
main.c
#include "external.h"
int main()
{
int a = myCppFunction(2000);
return a;
}
我明白这是因为cstdint是一个C++标准库,我正试图通过我的C文件使用它.
我的问题是:
- 有没有办法在我的C项目中使用这个C++库而不修改我的库?
- 如果没有,在图书馆方面我该怎么做才能做到这一点?