[Scons-users] error: stray '\' in program

Mahmood Naderan nt_mahmood at yahoo.com
Sat Apr 19 04:06:45 EDT 2014


Hi
While compiling a program with scons, I get these errors

    build/opt/zsim_harness.cpp:315:5: error: stray '\' in program
    build/opt/zsim_harness.cpp:315:5: error: stray '#' in program
    build/opt/zsim_harness.cpp: In function 'int main(int, char**)':
    build/opt/zsim_harness.cpp:310:24: error: 'ZSIM_BUILDVERSION' was not declared in this  scope
    build/opt/zsim_harness.cpp:315:5: error: expected ')' before 'n'
    build/opt/zsim_harness.cpp:315:5: error: 'ZSIM_BUILDVERSION' was not declared in this scope

The line that has such bug contains

    info("Starting zsim, built %s (rev %s)", ZSIM_BUILDDATE, ZSIM_BUILDVERSION);

`ZSIM_BUILDVERSION` is a macro which is defined in SConstruct

    if os.path.exists(".git"):
        env.Command(versionFile, allSrcs + [".git/index", "SConstruct"],
            'echo "#define ZSIM_BUILDDATE \\""`date`\\""\\\\n#define ZSIM_BUILDVERSION \\""`python misc/gitver.py`\\""" >>' + versionFile)
    else:
        env.Command(versionFile, allSrcs + ["SConstruct"],
            'echo "#define ZSIM_BUILDDATE \\""`date`\\""\\\\n#define ZSIM_BUILDVERSION \\""no git repo\\""" >>' + versionFile)

The generated output looks like

 
    #define ZSIM_BUILDDATE "Sat Apr 19 12:32:10 CET 2014"\n#define ZSIM_BUILDVERSION "master:10:a8c417b:2fc 2+ 1- ba884341"


The scons version is 2.1.0
Any idea to fix that?


 
Regards,
Mahmood
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20140419/4ba007b7/attachment-0001.htm


More information about the Scons-users mailing list