×

签到

分享到微信

打开微信,使用扫一扫进入页面后,点击右上角菜单,

点击“发送给朋友”或“分享到朋友圈”完成分享

寒武纪运行时库用户手册里的main.cpp应该怎么编译 已完结 幺白幺木2023-03-21 10:33:02 回复 2 查看 使用求助
寒武纪运行时库用户手册里的main.cpp应该怎么编译
分享到:

ceef5165462c9ca4764b74379b6b2ae.png

g++ main.cpp -lcnrt -std=c++11 -o main

当进行g++编译时报错:

/tmp/main-qutmEd.o: In function `main':
main.cpp:(.text+0x11a): undefined reference to `kernel'
cncc: error: er command failed with exit code 1 (use -v to see invocation)


cncc main.cpp kernel.mlu -o main

进行cncc编译时报错:

In file included from main.cpp:1:
In file included from /usr/local/neuware/lib/clang/5.0.1/include/bang_wrappers/stdio.h:30:
/usr/local/neuware/lib/clang/5.0.1/include/bang_device_types.h:29:2: error: "This file is for BANG compilation only."
#error "This file is for BANG compilation only."
 ^
/usr/local/neuware/lib/clang/5.0.1/include/bang_device_types.h:157:51: error: use of undeclared identifier 'half'
typedef __attribute__((__vector_size__(2 * sizeof(half)), aligned(1024))) half v2f16;
                                                  ^
/usr/local/neuware/lib/clang/5.0.1/include/bang_device_types.h:157:75: error: unknown type name 'half'
typedef __attribute__((__vector_size__(2 * sizeof(half)), aligned(1024))) half v2f16;
                                                                          ^
/usr/local/neuware/lib/clang/5.0.1/include/bang_device_types.h:158:51: error: use of undeclared identifier 'half'
typedef __attribute__((__vector_size__(2 * sizeof(half)), aligned(1024))) half v1f16;
                                                  ^
/usr/local/neuware/lib/clang/5.0.1/include/bang_device_types.h:158:75: error: unknown type name 'half'
typedef __attribute__((__vector_size__(2 * sizeof(half)), aligned(1024))) half v1f16;
                                                                          ^
In file included from main.cpp:1:
/usr/local/neuware/lib/clang/5.0.1/include/bang_wrappers/stdio.h:37:36: error: conflicting types for 'vprintf'
__mlu_device__ __mlu_builtin__ int vprintf(const char *, const char *);
                                   ^
/usr/include/stdio.h:333:12: note: previous declaration is here
extern int vprintf (const char *__restrict __format, _G_va_list __arg);
           ^
In file included from main.cpp:2:
/usr/local/neuware/lib/clang/5.0.1/include/bang_wrappers/stdlib.h:49:10: error: use of undeclared identifier '__mlvm_scalar_abs_s32'
  return __mlvm_scalar_abs_s32(__x);
         ^
/usr/local/neuware/lib/clang/5.0.1/include/bang_wrappers/stdlib.h:52:10: error: use of undeclared identifier '__mlvm_scalar_abs_s16'
  return __mlvm_scalar_abs_s16(__x);
         ^
8 errors generated.


是我编译的命令不对还是编译步骤不对,我该怎么去编译main.cpp

版权所有 © 2024 寒武纪 Cambricon.com 备案/许可证号:京ICP备17003415号-1
关闭