c++ - 将 C++ 从 Linux 移植到 Windows, '__aligned__'

标签 c++ linux windows gcc porting

<分区>

我正在尝试将一些代码从 Linux 移植到 Windows,但遇到了问题。

这一行:

uint8_t patch_[patch_size_*patch_size_] __attribute__ ((aligned (16)));

给我:

Error   C3861   'aligned': identifier not found

Error   C3646   '__attribute__': unknown override specifier 

这是 Linux 到 Windows 的问题吗?我在任何地方都找不到 aligned__attribute__ 的定义。

(我尝试移植的代码是:https://github.com/uzh-rpg/rpg_svo)

最佳答案

这是一个gcc到 MSVC 问题。根据the documentation ., 等效的 MSVC 功能将是 __declspec(align(16))

如果您的编译器支持 C++11,您还可以使用 alignas声明。

关于c++ - 将 C++ 从 Linux 移植到 Windows, '__aligned__',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41913468/

相关文章:

c++ - 如何在 C++ 的多重继承上下文中使用来自特定基类的运算符

linux - 使用 chroot 运行 snmp 没有给出当前值

linux - 如何解决构建的.so文件出现undefined symbol错误?

windows - 如何删除 Windows 静态库中导出的符号?

c++ - 规则定义中的 AST 和运算符优先级

c++ - 我的服务器代码有什么问题(C++)

c++ - 使用 UDP 通过 UDP 将数据传输到非 ROS 计算机

linux - WolfSSL on FreeRTOS 与 Linux 通信

c++ - 在没有 Visual Studio 的情况下编译依赖 <windows.h> 的程序

windows - 有没有一种简单的方法可以从嵌套的批处理脚本中捕获错误代码 (%errorlevel%)?