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:

 
 

c4,configure the debug environment的更多相关文章

  1. DVWA----DVWA System error - config file not found. Copy config/config.inc.php.dist to config/config.inc.php and configure to your environment.

    DVWA简介:DVWA(Damn Vulnerable Web Application)是一个用来进行安全脆弱性鉴定的PHP/MySQL Web应用,旨在为安全专业人员测试自己的专业技能和工具提供合法 ...

  2. 获取项目中文件,存放到Debug中。

    说起这个,还真是费了一般功夫. 说个最简单的方法: 第一步:把需要生成到Debug中的文件放到项目中(注意:当前文件夹目录是什么样的,存放到Debug中也是什么样) 第二部:设置文件属性中 复制到输出 ...

  3. 在进行make之前,configure的时候,请先清理config.cache

    在进行make之前,configure的时候,请先清理config.cache

  4. VC中出现“烫”和“屯”的原因(栈区的每一个字节都被0xCC填充了,也就是int 3h的机器码,动态分配的堆,VC的Debug用0xCD填充堆的空间,就出现了“屯”)

    相信经常用VC的朋友对屏幕输出的一大堆“烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫烫”不会陌生,但是也许会很奇怪,为什么会出现“烫”字呢?莫非改程序导致系统运行缓慢,发热过高???非也!下面让我解释 ...

  5. MinGW 编译 libsndfile-1.0.25(只要有 MSYS,./configure make make install 就行了)

    最近做的一个项目需要读写 wav 文件.在网上找到 libsndfile 刚好满足我的需要.但是编译的时候遇到了点小麻烦,这里记录一下编译的过程,免得下次再编译时忘记了. 因为是在编译完成若干天后写的 ...

  6. iOS应用发布打包时为什么选择release,而不是debug

    一.Debug和Release版本区别? 众所周知,我们进行iOS开发,在Xcode调试程序时,分为两种方式,Debug和Release,在Target的Setting中相信大家应该看到很多选项都分为 ...

  7. HBase二次开发之搭建HBase调试环境,如何远程debug HBase源代码

    版本 HDP:3.0.1.0 HBase:2.0.0 一.前言 之前的文章也提到过,最近工作中需要对HBase进行二次开发(参照HBase的AES加密方法,为HBase增加SMS4数据加密类型).研究 ...

  8. 使用eclipse启动tomcat,正常模式下可以启动tomcat,却在debug模式下无法启动tomcat 问题解决

    这个问题可能是由于eclipse和tomcat的交互而产生的,在以debug模式启动tomcat时,发生了读取文件错误,eclipse自动设置了断点,导致tomcat不能正常启动. 解决方法把brea ...

  9. 安装php,nginx 带debug

    gdb安装包   在CentOS6.4下使用gdb进行调试的时候, 使用bt(breaktrace)命令时,会弹出如下的提示: 头一天提示: Missing separate debuginfos, ...

随机推荐

  1. apache 局域网访问

    很多的朋友都想把自己的电脑打造为服务器使别人能够访问.比如说你自己写了一网站,只能自己通过localhost访问或127.0.0.1访问.但是怎么让别人的电脑也能访问呢?来看看自己写的网站.现在我来讲 ...

  2. C++学习注意点

    1.cin,cout关同步再用,不然效率很糟cin,cout关同步再用,不然效率很糟cin,cout关同步再用,不然效率很糟.重要的事情说三遍.关同步代码:std::ios::sync_with_st ...

  3. ${param.xxx}获取url中的参数

    在项目中看到了一个很奇怪的EL表达式...${param.catid}...一直找不到param在哪里定义的...(主要是水平太屎...) 然后从网上查了一下才知道是啥... EL表达式${param ...

  4. 了解Android的编译器

    了解一下Android的编译器并记录下来: Android在4.4以前是使用Dalvik VM的,通过Just In Time(JIT即时编译)来完成编译工作,在Android4.4提供了一种测试版本 ...

  5. 高德地图JavaScript开发

    项目需求:标注一个或者两个点.显示信息窗体.自定义icon <!DOCTYPE html> <html lang="en"> <head> &l ...

  6. 不在折腾---hbase-0.96.2-hadoop2

    首先安装好zookeeper集群 上传hbase安装包 解压 配置hbase集群,要修改3个文件 * 修改hbase-env.sh 设置JAVA_HOME: export JAVA_HOME=... ...

  7. 读取中文目录(python)

    前言:需要对某目录下的文件进行分类,目录是中文名字就会报错,偶尔会手动修改文件名字,不太方便 解决办法:使用unicode()对路径进行处理 举例: 未进行处理前,该目录下的文件中文名称也是乱码显示的 ...

  8. 解读浮动闭合最佳方案:clearfix

    .clear{clear:both;height:0;overflow:hidden;} 上诉办法是在需要清除浮动的地方加个div.clear或者br.clear,我们知道这样能解决基本清浮动问题. ...

  9. php学习函数

    1defined和define区别 2.dirname(__FILE__) 3.set_include_path 4.get_include_path 5.realpath() 6.require_p ...

  10. win7远程连接 您的凭据不工作

    1.查看远程连接有没有打开:计算机->属性->远程设置. 2.如果上面开启了还是不行,找到开始--- 运行-- 输入 gpedit.msc,打开注册表编辑器:然后依次找到菜单,计算机配置- ...