[求助]我不知道怎么用stdafx.h
在stdafx.h和stdafx.cpp中分别做些什么工作啊
在stdafx.h和stdafx.cpp中分别做些什么工作啊
比如我要建一个工程有3个文件:
一、snake.cpp
需要的头文件是:
#include <iostream>
#include "snake.h"
#include <windows.h>
二、snake.h
需要的头文件是:
#include <windows.h>
#include <ctime>
#include <iostream>
#include "snake.h"
三、main.cpp
需要的头文件是:
#include <vector>
#include <queue>
那么在stdafx.h和stdafx.cpp中分别应该加什么呢?
因为C++的编译方式是.cPP文件参与编译,所以stdafx.cpp是参与编译,所以一定要在里面调用"stdafx.h"
而stdafx.h里面就调用了很多MFC必须的头文件,例如#include <afxwin.h>,所以那些vector,之类的头文件应该在stdafx.h上用,而且很多文件都是调用"stdafx.h",所以你写在stdafx.cPP是没有用的