cc 和 cpp 混合情况的 makefile

今天需要写一个 makefile,项目里面有 pb 生成的 cc 和 cpp 文件,分别要生成各自的 obj,以前没有遇到过这种 cc 和 cpp 混合的情况,上网找了一下,找到这个模版,http://lcinx.blog.163.com/blog…: # # c.cpp混合编译的makefile模板 # # BIN = test.exe CC = gcc CPP = g++ #这里只加入库头文件路……

阅读全文

strncpy 的用法

在官方的文档中,http://www.cplusplus.com/refer…,例程的 strncpy 的用法是: /* strncpy example */ #include <stdio.h> #include <string.h> int main () { char str1[]= "To be or not to be"; char str2[40]; char str3[40]; /* copy to sized buffer (overflo……

阅读全文

GCC “-fomit-frame-pointer”编译选项的含义

在 makefile 中看到这个编译选项,不太理解于是查了一下,相关的东西还不多,抄一下放在这里 首先这个文章,http://blog.csdn.net/byzs/arti…,讲的不错,挺清晰的: 优化你的软件时,发觉”-fomit-frame-pointer”这个选项还是蛮有用的。 GCC手册上面这么说: Don’t keep the frame pointer in a……

阅读全文

使用 gperftools 分析 cpp 程序性能

首先从这里,https://code.google.com/p/gper…,下载 gperftools-2.1.tar.gz 接下来的操作教程主要参看这篇文章,http://www.searchtb.com/2012/1…,Google CPU Profiler使用指南及小工具,已经写的很好了,其中需要注意的问题有几个: 原文的 Makefile 没有排版,需要自己去 tab 缩进,不然在 make 的时候……

阅读全文

Python 的一个 Bug

今天要写一个统计脚本,于是打开 Aptana,建了一个文件叫 stat.py,取的 statistics 的缩写,但是一直报错如下 Traceback (most recent call last): File "C:\Python27\lib\site.py", line 62, in <module> import os File "C:\Python27\lib\os.py", line 63, in <module>……

阅读全文