大概在不久前用 C語言實現播放器的時候看到相關的代碼里有這個頭文件,在codeblocks和vc++里面單文件都無法編譯,而且就算使用
appwizard也只出現了可以編譯但是無法運行的尷尬情況。網上的關於stdafx.h的解決方法全都是說“恩恩很簡單”或者“我的編譯沒問題啊”
其實僅僅打開看這個頭文件確實不太難/*測試一下插入代碼插件*/,解決辦法就是把這堆代碼復制一下到自己新建的“stdafx.h”里面,之后
放在和你的源文件一個目錄下面就行啦。就醬,可以編譯嘍。~\(≧▽≦)/~
// stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #if !defined(AFX_STDAFX_H__4607A810_33E2_483D_80D8_BE41F0D473D5__INCLUDED_) #define AFX_STDAFX_H__4607A810_33E2_483D_80D8_BE41F0D473D5__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // Insert your headers here #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #define DLLEXPORT __declspec(dllexport) #define DLLIMPORT __declspec(dllimport) #include "stdio.h" #include <windows.h> #include <winsock2.h> #include <ws2tcpip.h> #pragma comment(lib,"ws2_32.lib") // TODO: reference additional headers your program requires here void Msg(char *szFormat, ...); void dbMsg(char *szFormat, ...); //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_STDAFX_H__4607A810_33E2_483D_80D8_BE41F0D473D5__INCLUDED_)