references to including header

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <memory>
unique_ptr
shared_ptr
enable_shared_from_this
 
#include <algorithm>
remove
find
remove_if
find_if
 
#include <sstream>
istringstream
ostringstream
stringstream
 
#include <stdint.h>
int64_t
 
#include <unistd.h>
sleep

gcc多个include目录的优先级

gcc默认include路径

1
2
`gcc -print-prog-name=cc1` -v
`g++ -print-prog-name=cc1` -v

优先级由大到小对应下表中的从上到下

1
2
3
4
5
命令行-I指定,前面的大于后面的
CPATH
CPLUS_INCLUDE_PATH	#只对c++文件起作用
C_INCLUDE_PATH		#只对c文件起作用,即C_INCLUDE_PATH和CPLUS_INCLUDE_PATH不会同时起作用
gcc默认include路径

refer to:
http://www.3scard.com/index.php?m=blog&f=view&id=42

dll中的全局类实例什么时候初始化

如果外部工程ExeB调了动态库DllA中的函数,当ExeB运行时,DllA中的全局类实例一定会初始化,但不一定非得在ExeB中调DllA中的函数后DllA中的全局类实例才会初始化,比如在DllA中代码如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
class DllA01()
{
public:
	DllA01()
	{
		MessageBoxA(NULL, "init", NULL, 0);
	}
	~DllA01()
	{
		MessageBoxA(NULL, "fini", NULL, 0);
	}
	void test(void)
	{
		MessageBoxA(NULL, "test", NULL, 0);
	}
};
__declspec(dllexport) DllA01 gA01;
extern "C" __declspec(dllexport) void dllA01Test(void)
{
	MessageBoxA(NULL, "dllA01Test", NULL, 0);
}

在ExeB中加入

1
2
3
4
#pragma comment(lib, "DllA.lib")
#pragma comment(linker, "/include:__imp__dllA01Test")
//#pragma comment(linker, "/include:__imp_?gA01@@3VDllA01@@A")
//#pragma comment(linker, "/ENTRY:foo")