- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有一个复杂的 C 项目。在文件 message.h
中声明了这个结构
struct message
{
int err;
struct header
{
char *protocol_version;
char *type;
long int sequence_number;
} header;
struct body
{
int num_tag;
char *tag_labels[LEN];
int num_attr_tag[LEN];
char *attr_labels[LEN][LEN];
char *attr_values[LEN][LEN];
char *attr_types[LEN][LEN];
} body;
};
在文件“castfunctions.h”中,我包含文件“message.h”并声明函数“setClientNat”
#include <message.h>
void *setClientNat(struct message *msg);
当我编译时,我有这个警告
castfunctions.h:warning:
declaration of 'struct message' will not be visible outside of this function [-Wvisibility]
void *setClientNat(struct message *msg);
谁能帮帮我?
最佳答案
declaration of 'struct message' will not be visible outside of this function [-Wvisibility]
该警告意味着 struct message
在那一点上没有声明,所以它作为一个无用的前向声明。
这意味着您显示的代码不是完整的事实,您的文件中包含的内容比您显示的要多得多 - 错误在于未显示给我们的代码。
以下是您可能会收到警告的几个原因;
#include <message.h>
包含一个与您认为的完全不同的文件,去别处寻找另一个 message.h。
你的消息中包含了守卫。h 就像这样
#ifndef MESSAGE_H
#define MESSAGE_H
struct message {
....
};
#endif`
然后像这样在源文件中使用头文件:
#include <thisnthat.h>
#include <message.h>
恰巧 <thisnthat.h>
文件还定义了一个
MESSAGE_H 宏,使整个 message.h 不可见。或者 thisnthat.h
header 有一个 #define message something_else
直接或间接与 message.h 一起包含的头文件中某处存在语法错误。去寻找失踪者;或 { 或 }
你拼错了什么。您的评论表明当您执行 typedef struct Message
时错误消失了由于某种原因有Message
有资本M
.所以在某个地方你混淆了struct Message
对比struct message
关于c++ - C : Warning about visibility of a struct,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20007364/
我制作了一个 DIV 和 visibility: hidden 并附加了一个 ::before 这个 DIV 的伪元素 visibility : 可见。这在 Firefox、Chrome 和 Safa
我正在使用 jquery 可见选择器来检查子元素是否可见。但令人惊讶的是 .is("visible") 和 .is(":visible") 在使用 css Visibility:hidden 时显示不
我有这个代码 #checkboxDIV { visibility: hidden; } #itemcard:hover #checkboxDIV {
我有一个用 ul 创建的菜单/li列出。 为了创造一个不错的效果,我有以下 css: #menu ul { /* ... */ visibility:hidden; /* ..
我想要的是,当我点击 Dashboard Button 时,它会像 SlidingDrawer 一样打开,打开后再次点击它会关闭。我使用这个自定义抽屉是因为 SlidingDrawer 已弃用。 现在
如何使用 jQuery 只选择可见元素? jQuery 选择器 :visible 和 :hidden 只尊重 display:none 作为真的隐藏?不是可见性:隐藏或可见性:可见。 我知道它们在技术
为什么我的 $('#myDiv').css('visibility', 'visible'); 不起作用? $('#clickdiv').click(function() { alert($(
在 $(document).ready 函数中通过 JavaScript 将子容器设置为 visibility: visible 时,我遇到了一个奇怪的问题。 问题是: 我有一个父元素,它有 boot
在 jQuery 中: e.is(':visible'); 检查元素是否显示。 jQuery 中是否有一个函数可以检查元素是否具有隐藏或可见属性可见性? 现在我必须自己实现这个功能。但我想使用 jQu
我在 mvc 中使用一个帖子表单,在帖子中我想显示一个隐藏的 div(惊喜)。 我正在使用 js/jquery 来显示 div,它可以在所有浏览器中工作,除了 mac 上的 safari :( 我现在
我似乎无法获得我的 jquery {{NotificationNavDot}} 功能正常工作! 在下面找到帮助文件: {{NotificationNavDot}} 在下面找到我的帮助
WPF 中的 Visibility.Collapsed 和 Visibility.Hidden 有什么区别? 最佳答案 不同之处在于,Visibility.Hidden隐藏了控件,但保留了它在布局中占
我有一个 if 语句来检查我的 div 下面是否没有任何可见内容,如果是,我会隐藏子元素的同级元素。 var $remainingprojects = $searchproject.s
这是我的菜单模型 HTML Menu 1 (overflow:hidden) Item 1 submenu 1 submen
编辑 3 实际上,我根本不需要弄乱可见性/不透明度...所以我删除了那些行(如编辑 2 所示)...添加了动画 -播放状态:暂停/运行.... 得到了我想要的效果... 编辑 2:感谢 Gineto
在我的应用程序中有一个广告 WebView ,它在 Activity 开始时调用一个 url。一切都很好,除了一件小事,它更像是一个可见性问题......所以问题是,当我开始 Activity 时,我
根据 the "visible" binding documentation , 如果 visible 的值为 false,Knockout 使用 display: none 隐藏元素。我怎样才能让它
* { margin: 0; padding: 0; border: 0; } .navBar { background-color: #2A2A2A; min-width: 10
android 布局使用 layout_weight。我的目标是所有组件的 1/3,但有时页脚实际上设置为消失,然后可见。从 gone 设置为 visible 时,权重计算如何工作?我没有看到具有 1
我有两个单选按钮,两个文本框和一个按钮。 当我点击第一个按钮时,应该只会出现一个文本框,当我点击第二个按钮时,应该会出现两个文本框。 但我想使用 visibility:hidden|visible 属
我是一名优秀的程序员,十分优秀!