博客
2016-07-15 16:31
295 查看
hello 博客
我的第一个博客。
1 如何编译源代码
1. `./do`
2. 生成可执行文件`./cit`
2 如何使用cit-86
1. 命令格式`./cit -h`
2. 编译`./cit ./file/test.c test`
3. 生成可执行文件`./work/test`
4. 测试运行`./work/test`
void hanoi(string a, string b, string c, int n);
int main() {
int n;
out << "输入盘子个数:";
in >> n;
hanoi("A", "B", "C", n);
return 0;
}
void hanoi(string a, string b, string c, int n) {
if(n == 0) {
return;
} else {
hanoi(a, c, b, n - 1);
out << "Move " + n + ":\t[" + a + " --> " + c + "]\n";
hanoi(b, a, c, n - 1);
}
}
3 代码的结构和意思
-finstrument-functions 添加
instrument.c: In function ‘void __cyg_profile_func_enter(void*)’:
instrument.c:46:31: error: invalid use of ‘this’ in non-member function
fprintf(fp, "E%p\n", (int *)this);
this 是关键字。。。。改成this2
编译过程:
开始检测输入文件信息...
正在编译文件/home/lc/mygcc/cit-x86/ss.c。
<run: cd ./compiler
./compiler /home/lc/mygcc/cit-x86/ss.c n n n n n
cd ..
编译完成!(错误=0 警告=0)
正在汇编文件/home/lc/mygcc/cit-x86/work/ss.s。
正在汇编文件/home/lc/mygcc/cit-x86/work/common.s
*******************************************************************
<run: cd ./ass
./ass /home/lc/mygcc/cit-x86/work/ss n
cd ..
这一步产生了 s.o
>正在汇编文件/home/lc/mygcc/cit-x86/work/common.s。
<run: cd ./ass
./ass /home/lc/mygcc/cit-x86/work/common n
cd ..
这一步应该是产生 common.o
>正在执行链接。
<run: cd ./lit
./lit /home/lc/mygcc/cit-x86/work/ss.o /home/lc/mygcc/cit-x86/work/common.o /home/lc/mygcc/cit-x86/work/ss n
cd ..
><run: chmod +x /home/lc/mygcc/cit-x86/work/ss>
生成可执行文件/home/lc/mygcc/cit-x86/work/ss。
操作成功!
lc@PC:~/mygcc/cit-x86$ ./work/ss
hello world!
注意无法在目录外面运行 函数不知道为什么??
现在知道了,他们需要一个work文件夹
我的第一个博客。
1 如何编译源代码
1. `./do`
2. 生成可执行文件`./cit`
2 如何使用cit-86
1. 命令格式`./cit -h`
2. 编译`./cit ./file/test.c test`
3. 生成可执行文件`./work/test`
4. 测试运行`./work/test`
void hanoi(string a, string b, string c, int n);
int main() {
int n;
out << "输入盘子个数:";
in >> n;
hanoi("A", "B", "C", n);
return 0;
}
void hanoi(string a, string b, string c, int n) {
if(n == 0) {
return;
} else {
hanoi(a, c, b, n - 1);
out << "Move " + n + ":\t[" + a + " --> " + c + "]\n";
hanoi(b, a, c, n - 1);
}
}
3 代码的结构和意思
-finstrument-functions 添加
instrument.c: In function ‘void __cyg_profile_func_enter(void*)’:
instrument.c:46:31: error: invalid use of ‘this’ in non-member function
fprintf(fp, "E%p\n", (int *)this);
this 是关键字。。。。改成this2
编译过程:
开始检测输入文件信息...
正在编译文件/home/lc/mygcc/cit-x86/ss.c。
<run: cd ./compiler
./compiler /home/lc/mygcc/cit-x86/ss.c n n n n n
cd ..
编译完成!(错误=0 警告=0)
正在汇编文件/home/lc/mygcc/cit-x86/work/ss.s。
正在汇编文件/home/lc/mygcc/cit-x86/work/common.s
*******************************************************************
<run: cd ./ass
./ass /home/lc/mygcc/cit-x86/work/ss n
cd ..
这一步产生了 s.o
>正在汇编文件/home/lc/mygcc/cit-x86/work/common.s。
<run: cd ./ass
./ass /home/lc/mygcc/cit-x86/work/common n
cd ..
这一步应该是产生 common.o
>正在执行链接。
<run: cd ./lit
./lit /home/lc/mygcc/cit-x86/work/ss.o /home/lc/mygcc/cit-x86/work/common.o /home/lc/mygcc/cit-x86/work/ss n
cd ..
><run: chmod +x /home/lc/mygcc/cit-x86/work/ss>
生成可执行文件/home/lc/mygcc/cit-x86/work/ss。
操作成功!
lc@PC:~/mygcc/cit-x86$ ./work/ss
hello world!
注意无法在目录外面运行 函数不知道为什么??
现在知道了,他们需要一个work文件夹
相关文章推荐
- SVN安装及使用
- asp.net获取文件夹下的所有文件
- Java之美[从蛮荒到撬动地球]之设计模式四
- magento 消息机制和错误信息传递
- 动态改变storm的并发度
- java 在windows环境 android环境 linux环境对7z包的解压缩
- 退出账号时清除缓存
- JVM之数据类型
- "Android Touch事件分发机制"-Android面试必问"精华技能点"汇总
- 安装Subversion1.8.22(SVN)插件
- Unity Android插件错误 Found plugins with same names and architectures
- 最小最大和 纪中1443 桶排+枚举
- __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
- bzoj2442
- 可扩展ListView
- webapi集成owin使用Oauth认证时能获取accee_token仍无法登录的解决办法
- CentOS 7 install Nginx
- FastDFS常用命令
- 用Swift实现淘宝和大众点评的下拉刷新
- 协方差