[Scons-users] error: stray '\' in program
Dirk Baechle
tshortik at gmx.de
Sat Apr 19 05:34:13 EDT 2014
Hi Mahmood,
Am 19.04.2014 10:06, schrieb Mahmood Naderan:
> 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?
>
yes, you have to change your "echo" command, such that the output into
the versionFile gets split into two lines with a single #define each.
Try out the "echo" line in your shell first, to make sure it works. Then
copy it back to the Command() call in your SConstruct.
Best regards,
Dirk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20140419/aa6ef40d/attachment.html
More information about the Scons-users
mailing list