extern "C"说明:使C++能够调用C写作的库文件的一个手段

Posted on 2019-02-15 10:07  yacbo  阅读(218)  评论(0编辑  收藏  举报
#ifdef __cplusplus
extern "C"
{
#endif

#include "SDL.h"

#ifdef __cplusplus
}
#endif

  __cplusplus是cpp中的自定义宏。

  C和C++对函数的处理方式是不同的,extern "C"是使C++能够调用C写作的库文件的一个手段,如果要对编译器提示使用C的方式来处理函数的话,那么就要使用extern "C"来说明。

Copyright © 2024 yacbo
Powered by .NET 8.0 on Kubernetes