Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ - Precompiled headers issue

Okay so I am writing something up in C++ and last night it was fine, I could compile perfectly w/o a problem. I saved all of my stuff and closed VS 2010 Ultimate. This morning when I went to go work on my stuff I tried recompiling and I got just over 200 errors, I couldn't figure out why so I noticed there were a few more warnings than usual and it says that it is skipping my headers.

Warning C4627: '#include <iostream>': skipped when looking for precompiled header use.

I tried disabling precompiled headers for my main .cpp but when I compile it just gives me even more errors. Is there any way to fix this?

like image 232
Joshe343 Avatar asked Aug 08 '26 22:08

Joshe343


2 Answers

Putting on my magic telepathic helmet, you problem is:

Your #include "myPrecompiledHeader.h" is not the first include in a file, when it should be.

like image 97
AndyG Avatar answered Aug 10 '26 10:08

AndyG


You have not posted more information, though the warning says it skipped #include<iostream> because preprocessor was expecting a precompiled header file. In case of your Visual C++ project that file normally is stdafx.h, try adding it as,

#include "stdafx.h"

Add #include "stadfax.h" at the the top of your cpp file, just above other include directives.

like image 42
Abdullah Leghari Avatar answered Aug 10 '26 10:08

Abdullah Leghari



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!