c++ - 如何禁用警告“当前#pragma pack对齐值在包含文件中被修改”?
问题描述
我有一个使用 MSVC-2019 编译的 C++ Qt 项目。
并且编译器正在生成
warning: the current #pragma pack alignment value is modified in the included file [-Wpragma-pack]
,因为pshpack1.h
显然正在根据需要修改结构打包。
如何禁用警告? 鉴于它没有 W 编号。
#pragma warning (push)
#pragma warning (disable : 4200) // warning about zero size arrays
#include <pshpack1.h>
typedef struct
{
char table_pageno;
unsigned short table_count;
unsigned char table[];
} bad_block_info;
#include <poppack.h>
#pragma warning (pop)
解决方案
推荐阅读
- node.js - Express JS 路由可选参数
- python - Python 使用 Django 框架和 Postgres 连接到 Heroku 缺失模块的问题
- php - PHP在文本文件中爆炸多行文本
- android - 面临生成 11 个哈希密钥字符串的问题,该字符串在 SMS Retriever API 的官方文档中提供
- regex - 如何使用正则表达式提取作者姓名和出版日期?
- node.js - 如何使用标签更新 gitlab CI 中的节点版本
- php - 在 WordPress 非法字符串偏移中出现错误
- python - 使用 Outlook Rest api 更新联系人时出现“不支持 OData 请求”错误
- database - PostgreSQL 错误:进程仍在等待数据库 0 的关系 2676 上的 AccessShareLock
- java - 在 Android 上使用 GLES20 获得正确的非投影触摸坐标的问题