0
我使用jspin并试图包括c_code表达式中stdio.h中库:如何在jspin中指定C库的路径?
c_code
{
#include <stdio.h>
}
不过,我得到以下错误:
spin: error: No file 'stdio.h'
其中MinGW的安装和它我已经检查目录有stdio.h里面。因此,我想,这全是关于错误的路径。如何在jspin中设置包含路径?
我使用jspin并试图包括c_code表达式中stdio.h中库:如何在jspin中指定C库的路径?
c_code
{
#include <stdio.h>
}
不过,我得到以下错误:
spin: error: No file 'stdio.h'
其中MinGW的安装和它我已经检查目录有stdio.h里面。因此,我想,这全是关于错误的路径。如何在jspin中设置包含路径?
尝试:
c_decl {
\#include <stdio.h>
}
的\#
是关键部分(Spinroot.com for c_decl)。此外,使用c_decl{}
,因为.h
文件不包含代码。
关于fprintf()没有显示输出;我不能说我知道原因。我试过你的特定代码。下面是结果:
[email protected]$ rm /tmp/foo.bar
[email protected]$ spin -a test.pml
[email protected]$ gcc -o test pan.c
[email protected]$ ./test
hint: this search is more efficient if pan.c is compiled -DSAFETY
(Spin Version 6.2.4 -- 21 November 2012)
+ Partial Order Reduction
Full statespace search for:
never claim - (none specified)
assertion violations +
acceptance cycles - (not selected)
invalid end states +
State-vector 12 byte, depth reached 2, errors: 0
3 states, stored
0 states, matched
3 transitions (= stored+matched)
0 atomic steps
hash conflicts: 0 (resolved)
Stats on memory usage (in Megabytes):
0.000 equivalent memory usage for states (stored*(State-vector + overhead))
0.292 actual memory usage for states
128.000 memory used for hash table (-w24)
0.534 memory used for DFS stack (-m10000)
128.730 total actual memory usage
unreached in init
(0 of 2 states)
pan: elapsed time 0 seconds
[email protected]$ cat /tmp/foo.bar
some str
这里是我使用的代码:
c_decl {
\#include <stdio.h>
}
init {
c_code {
FILE *file;
file = fopen ("/tmp/foo.bar", "a+");
fprintf (file, "%s", "some str");
fclose (file);
}
}
感谢您的回答!反斜杠确实有窍门。但是,我的C代码不工作...我想写一些信息到一个文件,所以我写: '文件*文件; file = fopen(“C:\\ file.txt”,“a +”); fprintf(文件,“%s”,“some str”); fclose(file);' 但没有任何反应..我做错了什么? – 2013-04-09 07:15:53
这一切都在一个c_code {}声明?如果是这样,它应该工作。如果没有,你需要'c_track''文件'的值(这样它在回溯过程中不会丢失)。请注意,由于详尽的搜索,验证期间的打印输出可能会有意想不到的结果。 – GoZoner 2013-04-09 14:22:27
是的,这一切都在一个'c_code'块中... – 2013-04-09 16:46:39