dg65f 2015-12-14 12:05 采纳率: 0%
浏览 1468

这个类型转换怎么修改?

这段程序是freertos的一部分。在c编译器中编译通过,在c++编译器中报错。如下

....\FreeRTOS\portable\MemMang\heap_2.c(295): error: #415: no suitable constructor exists to convert from "std::uint8_t *" to "A_BLOCK_LINK"

下面是出错代码

/* xStart is used to hold a pointer to the first item in the list of free
blocks.  The void cast is used to prevent compiler warnings. */

// xStart.pxNextFreeBlock = ( void * ) pucAlignedHeap;

xStart.pxNextFreeBlock = static_cast<A_BLOCK_LINK>(pucAlignedHeap);
xStart.xBlockSize = ( size_t ) 0;

这个是他的定义
typedef struct A_BLOCK_LINK

{
struct A_BLOCK_LINK pxNextFreeBlock; /<< The next free block in the list. /
size_t xBlockSize; /
<< The size of the free block. */
} BlockLink_t;

/* Create a couple of list links to mark the start and end of the list. */
static BlockLink_t xStart, xEnd;

请问我应该如何修改这一部分?

  • 写回答

1条回答 默认 最新

  • 关注

    你要在C中用结构体数组来代替。。。。。。。。。。。

    评论

报告相同问题?

悬赏问题

  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办