外部“C” [英] extern "C"

查看:80
本文介绍了外部“C”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


只是为了确认除了正常工作功能之外最正确的方法。


1 。


我们需要添加externC变量/函数定义/声明?或者只需要添加变量/函数声明?


2.


extern怎么样?只需要声明或者声明和定义都是必需的吗?


BTW:以前,我只添加声明,但是在阅读了越来越多的代码后添加了声明和定义,我来到在这里提出这个问题。



提前谢谢,

George

解决方案

< blockquote>你知道externC是什么吗?是为了??



你知道extern是什么C是为??



我想我们都可以回答OP ...


当然,弱点。用于停止函数和变量的修改名称,对原始问题的任何评论?



你知道externC是什么吗?是为??



问候,

George


Hello everyone,


Just to confirm what is the most correct way beyond a just working function.

1.

We need to add extern "C" to both variable/function definition/declaration? Or only need to add to the variable/function declaration?

2.

How about extern? Declaration only or both declaration and definition are required?

BTW: previously, I only add to declaration, but after reading more and more code which add to both declaration and definition, I come to here to ask this question.


thanks in advance,
George

解决方案

Do you know what extern "C" is for??


Do you know what extern "C" is for??

I think we can all answer that for the OP...


Sure, weaknessforcats. Used for stopping mangling name for function and variable, any comments to my original question?


Do you know what extern "C" is for??


regards,
George


这篇关于外部“C”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆