關於控制台頭文件stdafx.h的解決方法。


大概在不久前用 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_)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM