Questions tagged [stdafx.h]

stdafx.h is a file, generated by Microsoft Visual Studio IDE wizards, that describes both standard system and project specific include files that are used frequently but hardly ever change.

Visual C++ will precompile this file to reduce overall compile times.

The AFX in stdafx.h stands for Application Framework eXtensions. AFX was the original abbreviation for the Microsoft Foundation Classes (MFC).

76 questions
2
votes
2 answers

changing from `stdafx.h` to `pch.h`

I clone a repo, c++ solution with 3 projects, a console application .exe a dll project .dll and a unit test .dll. I am not sure with what version of VS or compiler it was built or created. building the solution on my machine was throwing…
Amir-Mousavi
  • 4,273
  • 12
  • 70
  • 123
2
votes
0 answers

Nifty counter in precompiled header does not work

To fix a problem caused by the static (de-)initialization order fiasco I tried to use the Nifty Counter idiom aka Schwartz Counter. I noticed, however, that it does not work if the header file containing the static initializer is included inside…
sigy
  • 2,408
  • 1
  • 24
  • 55
2
votes
1 answer

If a particular header already included in stdafx.h - do I need to (have to/should to) to explicitly include it in a .cpp file?

If a particular header is already included in stdafx.h - do I need to (have to/should to) to explicitly include it in a .cpp file (which already includes the stdafx.h) ?
Andrew
  • 295
  • 4
  • 10
2
votes
2 answers

StdAfx + Header file - Order of inclusion in MFC application

I am using Visual Studio 2005. I created an MFC based console application named "StdAfx dependancy". The IDE created the following files for me. Resource.h StdAfx Dependancy.h stdafx.h StdAfx Dependancy.cpp stdafx.cpp I added another class CHelper…
bdhar
  • 21,619
  • 17
  • 70
  • 86
2
votes
1 answer

Why when I create a c++ class in visual studio 2013 from wizard I don't need to include headers from stdafx.h

I've found curios thing which I cannot explain. When I use class creation wizard in VS2013 it would create me .h and .cpp files with defined class basis. Example header file: #pragma once class SomeClass { public: SomeClass(); …
CodingFeles
  • 374
  • 5
  • 18
2
votes
1 answer

fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include

I have a Visual Studio 6.0 project that uses SQL Compact Server. I'm trying to update the solution to use on Visual Studio 2012, but i have the following error: fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include…
suuuzi
  • 602
  • 1
  • 8
  • 19
2
votes
1 answer

How can I get rid of stdafx.h error when compiling C++ with mex in matlab?

I am trying to compile a C++ code with mex but am unable to compile it successfully . Reading some related blogs, I installed both Microsoft Visual C++ 2010 Express and Windows Software Development Kit (SDK) 7.1 but still it's giving this…
Joy
  • 75
  • 1
  • 7
2
votes
3 answers

Memory leaks detection while using Boost

I would like to get the memory leaks information using _CRTDBG_MAP_ALLOC, and especially the files and line numbers, but I don't get them at the end. I only get something like this: {130} normal block at 0x00695128, 16 bytes long. Data: <\ E …
TigrouMeow
  • 3,669
  • 3
  • 27
  • 31
1
vote
1 answer

E1696 cannot open source file "stdafx.h" during compilation

I have two projects A and B. In project A, I have created a source file called Logger.cpp where I have #include "stdafx.h" in the includes part. The stdafx.h is present in the project A. In project A's properties, I have project B's header file…
1
vote
2 answers

Why does MS Visual Studio #include in stdafx.h by default?

MS Visual Studio 2017, new Windows Console Application project from VisualC++ category. The default stdafx.h header includes the following lines: #include #include And below them: // TODO: reference additional headers your…
user4385532
1
vote
1 answer

Visual Studio including a header before stdafx.h creates errors

Let's assume I have a class Person TestClass.h: #pragma once class Person { int age; std::string name; public: Person(int age, const std::string& name); private: int getAge(); std::string getName(); }; TestClass.cpp #include…
Daniel
  • 631
  • 9
  • 20
1
vote
1 answer

Namespace declared in Header file is not being recognized in Source File

What am i doing wrong here? APP.h #pragma once namespace App{ enum class AppStatus{ Exit, Menu, Run }; void frameLoop(); AppStatus state; } App.cpp #include "App.h" #include "stdafx.h" #include…
stimulate
  • 1,199
  • 1
  • 11
  • 30
1
vote
1 answer

how do i shot stdafx.h?

I am using Visual Studio 2010 to make a 3D model in C++ and OpenGL. I started a project on my home pc, and then decided to put it in a repository, so that I could get the code for development on my laptop and not have to keep transferring files…
ryanthescot
  • 327
  • 4
  • 16
1
vote
2 answers

error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?

I have a project, originally developed on Microsoft Visual C++ . NET, Version 7.0.9466 and it works very well. I tried to use MS 2013 to run my project, and when I try to build the project, I have this error menssage: error C1010: unexpected end of…
Darós
  • 158
  • 1
  • 3
  • 9
1
vote
1 answer

Precompiled Headers when using 3rd Party Source Code

I'm getting the following error: error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?` Which of course is a fair error, and I've dealt with it before. However,…
Mike Weir
  • 3,094
  • 1
  • 30
  • 46