c++
ChinaWallace
人类
展开
-
重复定义(multiple definition of)与重复包含
test-1.0使用#ifndef只是防止了头文件被重复包含(其实本例中只有一个头件,不会存在重复包含的问题),但是无法防止变量被重复定义。vi test.cincludeinclude “test.h”extern i; extern void test1(); extern void test2();int main() { test1(); printf(“ok\n”);转载 2016-04-26 09:29:56 · 5240 阅读 · 0 评论 -
vector用sort算法排序
用sort对vector排序有两种方法 方法1: #include //容器的头文件 #include //sort算法用到的头文件 #include //greater模版函数用到的头文件 using namespace std; struct Info { int x; bool operator >(const In转载 2016-04-26 09:33:41 · 2823 阅读 · 0 评论 -
C++递归遍历获取某一目录下文件md5值
md5.h#ifndef _MD5_H#define _MD5_H/* MD5 Class. */class MD5_CTX {public: MD5_CTX(); virtual ~MD5_CTX(); bool GetFileMd5(char *pMd5, const char *pFileName);private: unsigned long int原创 2016-12-09 14:51:21 · 2375 阅读 · 0 评论