我正在尝试编译一个简单的c++可下载对象模块,以便在vxWorks 6.8上运行。我正在按照这里的指示行事。我犯了一个错误,希望有人能对这个问题有所了解。提前感谢
#include <vxworks.h>
#include <stdio.h>
int helloworld()
{
printf("Hello World!!!");
return 0;
}我按照上述链接中的指示运行以下构建命令
1.汇编
C:/WindRiver/gnu/4.1.2-vxworks-6.8/x86-win32/bin/ccpentium.exe -o tester.o -march=pentium -builtin -DINCLUDE_CPLUS -DINCLUDE_CPLUS_LANG -DINCLUDE_CPLUS_DEMANGLER -DINCLUDE_CPLUS_IOSTREAMS -DTOOL=gnu -DCPU=PENTIUM -DINCLUDE_CPLUS_IOSTREAMS -I.-I$(WIND_BASE)/target/h -I$(WIND_BASE)/target/h/make/coreip.库-I$(WIND_BASE)/target/h/wrn/coreip -c tester.cpp
2.吞咽
C:\WindRiver\utilities-1.0\x86-win32\bin\nmpentium.exe tester.o \ wtxtcl C:\WindRiver\vxworks-6.8\host\resource\hutils\tcl\munch.tcl -c pentium > ctdt.c
3.编译munch生成的ctdt.c文件。
C:/WindRiver/gnu/4.1.2-vxworks-6.8/x86-win32/bin/ccpentium.exe -march=pentium中标识符-O2 -fno-builtin -I"C:\WindRiver\vxworks-6.8\target\h“-DINCLUDE_CPLUS -DINCLUDE_CPLUS_LANG -DINCLUDE_CPLUS_DEMANGLER -DINCLUDE_CPLUS_IOSTREAMS -DCPU=PENTIUM -DTOOL_FAMILY=gnu -DTOOL=gnu -c ctdt.c
错误
但是,无论何时编译ctdt.c,我都会得到以下错误:
ctdt.c: In function '_STI__15_ctors':
ctdt.c:20: error: stray '\10' in program
ctdt.c:20: error: flexible array member in otherwise empty struct抛出错误的代码ctdt.c如下所示。注意,我必须将它作为图像来包含,因为代码中有一个奇怪的字符,我无法在这里知道如何显示。
我认为错误与printf语句中的“有关”有关。
发布于 2018-03-21 17:29:39
我解决了这个问题。上面的munch步骤不正确,应该是: C:\WindRiver\utilities-1.0\x86-win32\bin\nmpentium.exe tester.o \ tclsh C:\WindRiver\vxworks-6.8\host\resource\hutils\tcl\munch.tcl -c pentium > ctdt.c。
https://stackoverflow.com/questions/49156045
复制相似问题