stdafx.h

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

Precompiled Header and MSBuild

限于喜欢 提交于 2020-01-04 01:20:11
问题 I have a precompiled header that needs to be included atop each .cpp in my project. I fear that I will waste a lot of time explaining and fixing that in coworkers code. Is there an MSBuild step that I can do to #include "stdafx.h" at the top of all my .cpp files so it dosen't need to do done manually? 回答1: You have the compiler option /FI pathname which virtually add #include "pathname" at the first line of the file. Note: the equivalent for gcc is -include path . 来源: https://stackoverflow

Error C1083 Cannot open include file: 'stdafx.h': No such file or directory

ぃ、小莉子 提交于 2019-12-21 22:10:58
问题 I am new to visual studio.I have created a simple console application and then selected an empty project of c++.Then pasted the following code #include "stdafx.h" #include <cstdio> #include <iostream> #include <fstream> #include "opencv2/core/core.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/calib3d/calib3d.hpp" #include "opencv2/highgui/highgui.hpp" #include <vector> #include "GL/glut.h" #include "GL/glu.h" #include "GL/gl.h" #include <math.h> #include <time.h> using

Intellisense in vs2010 with c++

限于喜欢 提交于 2019-12-19 07:34:50
问题 I can't get intellisense to work. Even if I start with an empty project and add just one file to it with only an include for iostream and an int main() function that prints a char with cout (basically the most basic program), if I try to get intellisense to show anything (say by typing cout. ) I get IntelliSense: 'No additional information available' (See 'Troubleshooting IntelliSense in C++ Projects' for further help.) Hours of googling have yielded a couple of articles over at the Microsoft

Handling stdafx.h in cross-platform code

↘锁芯ラ 提交于 2019-12-18 09:59:44
问题 I have a Visual Studio C++ based program that uses pre-compiled headers ( stdafx.h ). Now we are porting the application to Linux using gcc 4.x. The question is how to handle pre-compiled header in both environments. I've googled but can not come to a conclusion. Obviously I want leave stdafx.h in Visual Studio since the code base is pretty big and pre-compiled headers boost compilation time. But the question is what to do in Linux. This is what I found: Leave the stdafx.h as is. gcc compiles

Why am I unable to #ifdef stdafx.h?

怎甘沉沦 提交于 2019-12-09 03:34:16
问题 I am trying to include 2 platform-specific stdafx.h files in my .cpp file, but the compiler is unhappy when I try to #ifdef it. #ifdef _WIN32 #include "stdafx.h" #elif _MAC #include "MAC/stdafx.h" #endif You may wonder why I am using stdafx.h in the Mac code, but that is not important at the moment :). When I try to compile the code on Windows, I receive: Fatal Error C1018 . I tried enclosing other header files with #ifdef in the same file, and the compiler was happy. Therefore, it looks like

Can't access function from header file

大城市里の小女人 提交于 2019-12-02 04:26:52
问题 //head.h// extern int sum(int,int); //head.cpp// #include "head.h" #include "stdafx.h" int sum(int x, int y) { return (x+y); } //mainfn.cpp// #include "head.h" #include "stdafx.h" #include string #include iostream #include stdio.h using std::string; using std::cout; using namespace System; int main() { int x=10,y=2; printf("value: %d",sum(x,y)); Console::ReadLine(); return 0; } While buliding in Visual studio 2005, this vc++ project is giving following error: error C3861: 'sum': identifier

afxwin.h issues in Visual Studio 2015 Windows Form App

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 14:14:21
A while ago i wrote a C++ CLI Windows Form app, which compiled fine in Visual Studio 2013. Now i wanted to recompile it in Visual Studio 2015 Update 1 but i'm facing a problem, and after hours of tests i figured out the culprit is afxwin.h . TL;DR - Is there any way i can use stdafx.h (so afxwin.h and all other imports coming with it) in a Windows Form app compiled with Visual Studio 2015 without having the app crash upon start? Here's how to reproduce the same issues i'm facing in my app. Since Windows Form is no longer available as project template in VS2015, i created a CLR Empty Project

Why does stdafx.h work the way it does?

时光怂恿深爱的人放手 提交于 2019-11-30 18:05:25
As usual, when my brain's messing with something I can't figure out myself, I come to you guys for help :) This time I've been wondering why stdafx.h works the way it does? To my understanding it does 2 things: Includes standard headers which we might (?) use and which are rarely changed Work as a compiler-bookmark for when code is no longer precompiled. Now, these 2 things seems like two very different tasks to me, and I wonder why they didn't do two seperate steps to take care of them? To me it seems reasonable to have a #pragma-command do the bookmarking stuff and to optionally have a

Why does stdafx.h work the way it does?

我是研究僧i 提交于 2019-11-30 16:51:34
问题 As usual, when my brain's messing with something I can't figure out myself, I come to you guys for help :) This time I've been wondering why stdafx.h works the way it does? To my understanding it does 2 things: Includes standard headers which we might (?) use and which are rarely changed Work as a compiler-bookmark for when code is no longer precompiled. Now, these 2 things seems like two very different tasks to me, and I wonder why they didn't do two seperate steps to take care of them? To