How many headers can a project have?

closed account (365X92yv)
^

meant to ask header files.

I have a project and keep getting a weird error when I try to integrate them in main.
Last edited on
There is no limit.

It might help if you told us what the error was.
closed account (365X92yv)
Error: PCH warning: header stop cannot be in a macro or #if block. An intellisense PCH file was not generated. This is on the "class SecretWord" line in my header file. Then, I get the same error on the "using namespace std;" line if I include it.
sounds like you have precompiled headers enabled, but aren't #including them in your source files.

Solutions:

1) Go in your project settings and disable precompiled headers

2) Make sure the very first thing you do in every source file (.cpp file) that uses precompiled headers (read: which is likely all of them) is to include the precompiled header. The header is probably "stdafx.h" unless you created it yourself and named it somethign different.

You cannot have any other includes, code, or preprocessor commands (like #if) before the pch include. It must be the very first thing. The only thing that can be before it is comments.


To avoid this problem in the future, when you create a project in visual studio, be sure to specify the "empty project" option so it doesn't set up all this PCH crap.
closed account (365X92yv)
How is it I can include one header and not get any errors but I can't the other?

EDIT: Nevermind. I think I know the problem. I may not have included the actual file in my project so when it compiles, its not recognizing the file being in the project. I'll report back in a minute if that was the hotfix
Last edited on
closed account (365X92yv)
Yep. That was it. I was bringing it up to the project and being able to edit it in the curret project but it was never adding my header file to the actual project. I just needed to add the header file to the project folder in explorer, save my solution, reload the project and it worked.
Topic archived. No new replies allowed.