首页 技术 正文
技术 2022年11月21日
0 收藏 539 点赞 3,539 浏览 2039 个字

  Yesterday I found a tiny C compiler (less than 600 line of C code, containing commits) called “c4” on github and I wanted to know how I can write a compiler in details.

  During the process, I encounter the following problems:

1> Can not compile c4 on Windows platform, because no “unistd.h” on Windows.

solution: replace the include sentence by the following statements:

  许多在Linux下开发的C程序都需要头文件unistd.h,但VC中没有个头文件, 
  所以用VC编译总是报错。把下面的内容保存为unistd.h,可以解决这个问题。

    1.   /** This file is part of the Mingw32 package.
    2.    *  unistd.h maps     (roughly) to io.h
    3.    */
    4.   #ifndef _UNISTD_H
    5.   #define _UNISTD_H
    6.   #include <io.h>
    7.   #include <process.h>
    8.   #endif /* _UNISTD_H */

2> IDEs:

First tried Vitual Studio 2013, it was hard for me to get used the VS after some many years’ leave. I could not find the proper functions to satisfy my needs.

Eclipse: Downloaded the Eclipse-CDT(for C/C++ development). Dowload the minGW project, containing the gcc and other lib file for windows. Configure eclipse, it is not complicated after I configure the BarLearner project from Cristian. Just make the build system right, and adjust the run configuration. But I fould I could not the value of global values and for most pointers, I could only see the address its point to rather than the  content (for example, I wanted to see an array, but got nothing useful for me.) Searching on the Internet, someone said we can see the global values on “Watch” windows. However, I did not think so after trying. I gave it up temporary.

VC6.0: This is a very old platform I had been working on for years. It took me time to install VC 6.0 on Windows 8.1. Here are some useful solution for the installation:

  “1 改名 MSDEV.EXE改成 MSDEV3.EXE
  2 兼容模式修改成 winxp sp2 或者sp3
  3 启动MSDEV3.EXE,如果报错,关闭,立刻再次启动,一般就可以正常启动了,成功启动一次后,以后就可以正常运行了
  4 取消兼容模式,如果运气好,也可以正常运行了,如果不介意,就一直用兼容模式运行也可以” After that, I found VC 6.0 can not show line number by default. WTF! I need a plug in to complete this need.  1. 如果你的VC安装在C盘,请拷贝文件VC6LineNumberAddin.dll到如下目录: C:\Program Files\Microsoft Visual Studio\Common\MSDev98\AddIns   2. 注册   双击VC6LineNumberAddin.reg进行注册。  3. 启用   打开vc6,菜单栏:Tools -> customize -> Add-ins and Macro Files 选中VC6LineNumber Developer Studio Add-in  关闭VC,重启VC即可。Also, I got a link for setting up vim+GDB environment:

http://easwy.com/blog/archives/advanced-vim-skills-vim-gdb-vimgdb/  

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,993
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,507
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,350
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,135
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,768
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,845