3

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

K.C.
  • 2,084
  • 2
  • 25
  • 38
Molmasepic
  • 1,015
  • 2
  • 13
  • 18

3 Answers3

6

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.

orlp
  • 112,504
  • 36
  • 218
  • 315
3

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++.

Nawaz
  • 353,942
  • 115
  • 666
  • 851
  • ok then what should i do about this GLM library i got(made by nate robins and downloaded from here: http://www.3dcodingtutorial.com/Working-with-3D-models/Getting-GLM.html and theres no reason to yell >-> – Molmasepic Mar 23 '11 at 16:36
  • then why doesnt my project have it?? – Molmasepic Mar 23 '11 at 16:38
  • @Molmasepic : MinGW doesn't create it. So you don't have to worry. Include header files manually. Also MinGW is a compiler. Not an IDE. An IDE usually creates some common header files and source files which then is edited and modified by the programmers! – Nawaz Mar 23 '11 at 16:42
  • well i thought it was the compiler that everyone wants to know about, in this case i use CodeBlocks – Molmasepic Mar 23 '11 at 16:43
  • @Molmasepic: No. As I said you don't have to worry about if it's not there. Just include the header files which you need manually. Everything should work fine then! – Nawaz Mar 23 '11 at 16:44
1

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

Rouf Khan
  • 11
  • 2