0

我在“Wiley-Embedded Signal Processing with the Micro Signal Architecture.2007”中解释了这个项目 -实现了2D DCT/IDCT(图像压缩),我想将(将这些文件移动到..)与另一个带有图像的个人项目结合起来在Visual Dsp for Blackfin BF 537中处理(只有 *.cpp 文件)。(首先在Simulator中,然后在板上 BF537 ..)

实施的项目 2D DCT/IDCT 有 *. c和*。asm文件,它工作得很好。在某些时候,对于某些计算,来自 C 文件的函数正在使用 asm 文件中声明(和实现)的函数。

我注意到如果我在我的项目中移动这些 *.c 文件(其中仅包含 *.cpp 文件),我会得到很多错误,其中一些像这样:

"`[Error li1021] The following symbols referenced in processor 'p0' could not be resolved:
   'something [_something]' referenced from '.\Debug\project name.doj'"

所以,我认为我需要在我的项目中只有 *.cpp 文件(而不是 *.cpp 和 *.c 的组合)。

2D DCT/IDCT项目中,当我更改所有这些 *. c文件到 *. cpp文件。当我尝试构建时,出现此链接错误:

"[Error li1021]  The following symbols referenced in processor 'p0' could not be resolved:
   '_r8x8dct(short *, short *, short *) [__r8x8dct__FPsN21]' referenced from '.\Debug\Start_DCT2.doj'
   '_r8x8invdct_ieee(short *, short *, short *) [__r8x8invdct_ieee__FPsN21]' referenced from '.\Debug\Start_DCT2.doj'"

在 *。cpp文件这是我如何调用在 asm 中实现的函数:

     _r8x8dct(in,coeff,temp);

在相同的 *。cpp文件我包含一个头文件,我在其中声明了函数:

     void _r8x8dct(fract16 *in, fract16 *coeff, fract16 *temp);

这是*的一部分。asm文件,其中包含函数:

     .section    L1_code;
     .global     __r8x8dct;
     .align      8;
     __r8x8dct:
     .....................................
     __r8x8dct.end:

模拟带功能$_r8x8invdct_ieee()

*请原谅我的英文写作错误

4

1 回答 1

0

要从 C++ 调用 C 函数,您需要使用 限定 C 函数原型extern "C",例如

extern "C" void _r8x8dct(fract16 *in, fract16 *coeff, fract16 *temp);

或者如果你有多个 C 函数,你可以像这样将原型组合在一起:

extern "C" {

    void _r8x8dct(fract16 *in, fract16 *coeff, fract16 *temp);

    // ... other C function prototypes ...
}
于 2012-01-28T13:48:21.260 回答