1.对于error:cannot convert parameter 1 from 'const char [12]' to 'LPCWSTR'
解决如下:方法1:Press ALT+F7 to open the properties, and navigate to Configuration Properties > General. Switch Character Set to "Use Multi-Byte Character Set".
方法2:Indicate that the string literal, in this case "Hello world!" is of a specific encoding. This can be done through either prefixing it with L, such as L"Hello world!", or surrounding it with the generic _T("Hello world!") macro. The latter will expand to the L prefix if you are compiling for unicode (see #1), and nothing (indicating multi-byte) otherwise.
2 DirectSound error C2065: ' DSBCAPS_CTRLDEFAULT' : undeclared identifier
A:The DX SDK documents are your friend. A quick search turned up this bit:
The DSBCAPS_CTRLDEFAULT flag is no longer supported. This flag was defined as DSBCAPS_CTRLPAN | DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLFREQUENCY. By specifying only the flags you need, you cut down on unnecessary resource usage.
3.
C语言头文件的多重包含与重复包含 |
|
一.头文件的多重包含 对于同一个.h文件,如果在多个.h文件所引用,而这多个.h文件又需要在同一个.cpp或者文件用引用时,这就涉及到C语言的头文件的多重包含。 例:有如下几个文件: file1.h: #endif 那么对于以上两个文件的重复包含不对导致编译错误。 也可以在每个文件的开始写出:#pragma once,保证本文件中的内容只被使用一次。 详细地说:如果有以下几个头文件及其包含关系为: File1.h,file2.h,file3.h,file4.h,file5.h,main.cpp 那么:file3.h包含file1.h,file2.h,file4.h包含file1.h,file2.h,file5.h包含file3.h,file4.h。这样就会导致在file5中对file1和file2的重复包含,编译时就会报错。 解决方法: 1:利用 #ifndef #define #endif 即每个文件在定义时都写成如下形式(以file1.h为例): #ifndef H_FILE1 #define H_FILE1 #i nclude #i nclude ….. #endif File3.h: #ifndef H_FILE3 #define H_FILE3 #i nclude #i nclude #inlcude”file1.h” #i nclude”file2.h” ….. #endif 方法二:在每个文件的头部定义:#pragma once (用于说明本文件中的内容只使用一次) 例:fiel1.h: #pragma once #i nclude #i nclude ….. File3.h: #pragma once #i nclude #i nclude #i nclude”file1.h” ….. |
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10697500/viewspace-541319/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10697500/viewspace-541319/