About stdafx.h missing in my compiler(mingw32 on windows)

心已入冬 提交于 2020-01-05 01:35:10

问题


I just have a quick question. I've noticed that I don't have stdafx.h in my compiler(mingw32 on windows)

Am I supposed to have it? Or maybe is there a way to get around it?

Thanks for reading

EDIT: ok here is my current build log once I took out ALL of the includes of stdafx.h

http://pastebin.com/bczLr8xY


回答1:


Read this wikipedia article. The paragraph I linked and the paragraph below it (mingw32 uses GCC).

http://en.wikipedia.org/wiki/Precompiled_header#stdafx.h

Since stdafx.h contains the most common headers I would remove every instance of #include stdafx.h and try to compile. If you get compile errors that a certain function is missing, add the appropriate header. Rinse and repeat.




回答2:


No. Stdafx.h is created with MSVC++. It usually contains most common headers files. And Stdafx.h is included in every .cpp file in the beginning. It's precompiled header (if you've chosen so in the settings) created by MSVC++.




回答3:


To all: Using the pre compiled header file stdafx.h in the visual C++ always creates one or the other problem n case u have created a "Windows Console App" from Visual C++. The Solution to it is that, just create "Empty Project", rather than the pre-compiled windows console application. After creating the Empty project, create the source File. Write the business logic and add all the required resource and header files. Keep the external dependency files in the same directory in which your source code is: e.g., C:\Users\John\Documents\Visual Studio 2010\Projects\xyz.cpp\xyz.cpp. Finally add the source file to the global scope, that is add it to the "Empty Project" created already. It can be done by Clicking "File" on Visual Studio prompt and select the option of adding the source file to the project. Thanks and Regards: Rouf Khan



来源:https://stackoverflow.com/questions/5408583/about-stdafx-h-missing-in-my-compilermingw32-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!