Search code examples
vxworks

Is there a solution to this VxWorks C++ demangling error?


I am attempting to compile a simple C++ downloadable object module to be run on VxWorks 6.8. I am following the instructions here. I am getting an error. How can I fix it?

#include <vxworks.h>
#include <stdio.h>

int helloworld()
{
    printf("Hello, World!!!!");
    return 0;
}

I run the following build commands as instructed in the aforementioned link

1. Compile

C:/WindRiver/gnu/4.1.2-vxworks-6.8/x86-win32/bin/ccpentium.exe -o tester.o -march=pentium -fno-builtin -DINCLUDE_CPLUS -DINCLUDE_CPLUS_LANG -DINCLUDE_CPLUS_DEMANGLER -DINCLUDE_CPLUS_IOSTREAMS -DTOOL=gnu -DCPU=PENTIUM -D_VSB_CONFIG_FILE=\"C:/WindRiver/vxworks-6.8/target/lib/h/config/vsbConfig.h\" -I. -I$(WIND_BASE)/target/h -I$(WIND_BASE)/target/h/make/rules.library -I$(WIND_BASE)/target/h/wrn/coreip -c tester.cpp

2. Run munch

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. Compile ctdt.c file generated by munch

C:/WindRiver/gnu/4.1.2-vxworks-6.8/x86-win32/bin/ccpentium.exe -march=pentium -fdollars-in-identifiers -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

Error

However, whenever compiling ctdt.c, I get the following error(s):

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

The line of code ctdt.c that is throwing the error looks like this. Note, I had to include it as an image because there is a strange character in the code that I could not figure out how to display here:

Code throwing error

I believe the error has something to do with the " in the printf statement. Commenting out the printf statement everything will compile file.


Solution

  • I resolved the issue. The munch step above is incorrect and should be: 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