Dev-C++是一个在Windows下用使用gcc编译器的IDE,我目前使用的版本是4.9.8.0版,下载地址为http://www.c-view.org/soft/devcpp/downloads/devcpp4980.exe,可以在它自己的主页http://bloodshed.net/或http://sourceforge.net/projects/dev-cpp/中找到关于Dev-C++的更多信息.
1.在Dev-C++中调试程序
用Dev-C++编写C++项目时,如果用菜单"Debug\Debug"调试时,系统会提示"Your project does not have debugging information, do you want to enable debugging and rebuild your project?",此时即使选"Yes"也还是不能调试.要在"Project/Class Brower"窗口中(通过View\Project/Class Brower调出该窗口),然后选中项目按右键,选"Project Options"在"Compiler"页中选"Linker"项,将其中的"Generate debugging information"设为"Yes".此时再重新链接一次程序,就可以调试了.
2.观察变量
在调试中观察变量值时,string类型的变量如果先加入到了Debug窗口中,单步走时是不会自动刷新的,所以需要将已经加入的变量删除后再添加才能看到新的值,但对int这样的变量是可以自动刷新的.
3.恢复c,cpp等文件与VC的关联
由于安装程序有bug,所以不管选不选于C,C++文件关联,安装完成后C,Cpp,H,rc等都会自动与Dev-C++关联,如果在"Tools\Emvironment Options"的"File Associ..."页中将与c,cpp,h,rc的关联去除,也不能恢复本来与VC的关联,而且在资源管理器中通过"工具\文件夹选项"的文件类型中,也看不到c,cpp,h,rc了.此时可以将下列内容放入一个扩展名为reg的文件中,导入到注册表中.注意,下面例子中,Visual Studio 6安装在F:\Program Files\Microsoft Visual Studio目录下,所以要根据具体情况修改路径.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cfile]
@="C Source file"
"AlwaysShowExt"=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cfile\DefaultIcon]
@="F:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe,-20210"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cfile\shell]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cfile\shell\&Open with MSDev]
@="&Open with MSDEV"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cfile\shell\&Open with MSDev\command]
@="\"F:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe\" \"%1\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cfile\shell\&Open with MSDev\ddeexec]
@="Open(\"%1\")"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cfile\shell\&Open with MSDev\ddeexec\application]
@="msdev"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cfile\shell\&Open with MSDev\ddeexec\topic]
@="system"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cppfile]
@="C++ Source file"
"AlwaysShowExt"=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cppfile\DefaultIcon]
@="F:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe,-20209"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cppfile\shell]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cppfile\shell\&Open with MSDev]
@="&Open with MSDEV"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cppfile\shell\&Open with MSDev\command]
@="\"F:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe\" \"%1\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cppfile\shell\&Open with MSDev\ddeexec]
@="Open(\"%1\")"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cppfile\shell\&Open with MSDev\ddeexec\application]
@="msdev"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\cppfile\shell\&Open with MSDev\ddeexec\topic]
@="system"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\rcfile]
@="Resource Template"
"AlwaysShowExt"=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\rcfile\DefaultIcon]
@="F:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe,-20212"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\rcfile\shell]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\rcfile\shell\&Open with MSDev]
@="&Open with MSDEV"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\rcfile\shell\&Open with MSDev\command]
@="\"F:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe\" \"%1\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\rcfile\shell\&Open with MSDev\ddeexec]
@="Open(\"%1\")"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\rcfile\shell\&Open with MSDev\ddeexec\application]
@="msdev"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\rcfile\shell\&Open with MSDev\ddeexec\topic]
@="system"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\hfile]
@="C Header file"
"AlwaysShowExt"=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\hfile\DefaultIcon]
@="F:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe,-20211"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\hfile\shell]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\hfile\shell\&Open with MSDev]
@="&Open with MSDEV"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\hfile\shell\&Open with MSDev\command]
@="\"F:\\Program Files\\Microsoft Visual Studio\\Common\\MSDev98\\Bin\\msdev.exe\" \"%1\""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\hfile\shell\&Open with MSDev\ddeexec]
@="Open(\"%1\")"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\hfile\shell\&Open with MSDev\ddeexec\application]
@="msdev"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\hfile\shell\&Open with MSDev\ddeexec\topic]
@="system"
然后在"工具\文件夹选项"的文件类型中,删除c,cpp,h,rc类型,再重新建立,建立类型时按下"高级"按钮,选择"关联的文件类型"
c选C Source file
cpp选C++ Source file
h选C Header file
rc选Resource Template