随笔分类 -  C/C++

c & c++ programming, including the compilier tools and IDE tools
code block自动生成makefile
摘要:安装插件http://developer.berlios.de/projects/cbmakegen/然后会在project菜单下面有一个Generate Makefile的选项点击就行了如果是在windows下面,会生成一个makefile.gen文件 阅读全文

posted @ 2011-08-22 10:22 vincenzo.lai 阅读(2939) 评论(0) 推荐(0)

MSYS访问其他盘符
摘要:1.MSYS安装好之后,不停的cd..,只能够访问到安装硬盘的最上层。比如安装在D盘,cd..只能访问到D盘的根目录。要想访问其他盘符,如E盘,方法是: cd /e/2.文件名 或目录名中如果带有空格,必须用双引号括起(例如"/C/Program Files")2.如果目录中含有空格,那么目录名称要用引号括起来,如cd "/c/Program Files"3.注意,斜杠的方向是/而不是\ 阅读全文

posted @ 2010-05-13 10:00 vincenzo.lai 阅读(4332) 评论(0) 推荐(0)

The "right-left" rule(zz)
摘要:The "right-left" rule is a completely regular rule for deciphering Cdeclarations. It can also be useful in creating them.First, symbols. Read * as "pointer to" - always on the left side [] as "arr... 阅读全文

posted @ 2010-03-22 16:17 vincenzo.lai 阅读(312) 评论(0) 推荐(0)

EOF
摘要:EOF = end of file在Windows下或者DOS下面,EOF=Crtl+Z在Linux下或者Linux下面,EOF=Ctrl+D在控制台要输入eof的话 按ALT+65535就可以了 阅读全文

posted @ 2010-02-13 10:32 vincenzo.lai 阅读(241) 评论(0) 推荐(0)

gcc不链接不用函数的方法
摘要:编译的四个步骤: 1.preprocessing,预处理 2.compilation proper,编译 3.assembly,汇编装配 4.linking,连接对于一个文件A,里面有很多函数,但是main函数只调用了其中的一个,其他函数也会被编译,也会被“打包”到最后的可执行文件中,要从中分离出不要的函数,方法如下:1.执行gcc -function-sections &... 阅读全文

posted @ 2010-01-05 22:30 vincenzo.lai 阅读(4328) 评论(1) 推荐(1)

fwrite写二进制文件
摘要:唯一需要注意的是:fopen的时候要用“wb+”而不是"w+"用“w+”,可能造成莫名其妙的多写入了几个字节 阅读全文

posted @ 2009-09-28 23:47 vincenzo.lai 阅读(1458) 评论(0) 推荐(0)

控制台程序按任意键继续的方法
摘要:在vc6里面,控制台程序,运行之后,有一个说press any key to continue然而,到vc2005就没有了,又想看一下console打印的结果解决办法有两种:1. 在main的最后加一句getchar()2. 在main的最后加一句system("pause")。需要#include <stdlib.h> 阅读全文

posted @ 2009-09-22 15:55 vincenzo.lai 阅读(2265) 评论(0) 推荐(0)

matlab函数编译成dll供Cpp调用的方法
摘要:以前做过matlab7与c++的混合编程:将m函数编译成dll给C++调用,从而加快开发的进度。但是今天在matlab2008b下面又做了一遍,发现matlab又改了很多东西,诸如增加了面向对象的的扩展mwArray,于是做笔记如下。 (一) 总体概念 matlab提供了丰富的程序接口,除了matlab最初的版本是用fortran写的之外,后来的版本都是用C写的,因此matlab很容易和C/C... 阅读全文

posted @ 2009-09-09 18:02 vincenzo.lai 阅读(23626) 评论(10) 推荐(3)

gcc的一些option
摘要:-c: compileor assemble the source files, but do not link. The linking stage simply is not done. The ultimate output is in the form of an object file for each source file. By default, the object file n... 阅读全文

posted @ 2009-09-02 14:39 vincenzo.lai 阅读(1173) 评论(0) 推荐(0)

gcc编译将编译信息输出到文件的方法
摘要:make >[file name] 2>&1 阅读全文

posted @ 2009-08-31 17:33 vincenzo.lai 阅读(1172) 评论(0) 推荐(1)

Eclipse开发c++(二)
摘要:这里对(一)中的一些东西做补充的说明1. MinGW自带一个make程序,但是ms大家对这个make的评价很差,于是eclipse推荐不要用这个make,而改用MSYS提供的make程序。2. 在(一)中,并没有提到安装MSYS,也没有安装make,但是为什么可以make,运行程序呢?是因为新版的C++ Eclipse 的CDT自带了一个make,可以make程序。3. CDT是一个强大的环境,可... 阅读全文

posted @ 2009-08-28 23:06 vincenzo.lai 阅读(1900) 评论(0) 推荐(0)

Eclipse开发c++(一)
摘要:本文主要说明,如何用Eclipse进行c++开发。准备工作:1. 下载安装jre。eclipse运行需要java支持,到http://www.java.com/zh_CN/download/manual.jsp#win上面去下载windows下的jre环境安装文件,建议下载脱机版的,因为这样,你可以到处copy安装。下载完之后,安装。2. 下载安装eclipse,到http://www.eclip... 阅读全文

posted @ 2009-08-27 23:23 vincenzo.lai 阅读(7289) 评论(0) 推荐(1)

C的struct内存对齐的问题(二)
摘要:#include <stdio.h>#include <iostream.h>int main(void){ typedef struct{ unsigned short a:8; unsigned short b:9; unsigned short c:10; }T_struct1; typedef struct{ unsigned short a:2; unsign... 阅读全文

posted @ 2009-08-25 10:53 vincenzo.lai 阅读(385) 评论(0) 推荐(0)

C的struct内存对齐的问题
摘要:采用VC6的的编译器对于struct:struct ST_DAT1 { char cDatA; int nDatC; char cDatB; } stDblChr;struct ST_DAT2 { char cDatA; char cDatB; int nDatC; } stDblChr;很显然,编译器在编译的时候,要做内存对齐的调整。由于两个struct中最长的变量都是int,占... 阅读全文

posted @ 2009-08-25 10:44 vincenzo.lai 阅读(1336) 评论(0) 推荐(0)

C在return之后执行函数
摘要:通过atexit调用函数,可以再main函数return之后再执行刚刚被调用的函数。msdn解释是:The atexit function is passed the address of a function (func) to be called when the program terminates normally. Successive calls to atexit create a ... 阅读全文

posted @ 2009-08-25 10:09 vincenzo.lai 阅读(946) 评论(0) 推荐(0)

导航