大概在不久前用 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_)
时间: 2024-12-26 06:01:03