-
December 11th, 2003, 04:06 AM
#1
stdafx.h
Hi,
I have a solution( i.e. workspace) which includes 3 projects.
Some classes ( so files ) are common in these projects. I have grouped them in a single folder called 'Common'. Therefore my folder view is like following.
C:\MyWorkspace
C:\MyWorkspace\Project1
C:\MyWorkspace\Project2
C:\MyWorkspace\Project3
C:\MyWorkspace\Common
In each C:\MyWorkspace\ProjectX folder contains a file 'stdafx.h'. Any .cpp file which is in Common directory has a #include "stdafx.h" line...
In compilation, the compiler gives "No such file... ( stdafx.h )" error. This may be interpreted as natural, since 'stdafx.h' is not in the same directory. It is in the directory of 'C:\MyWorkspace\ProjectX'. However I can not write "#include ..\ProjectX" because it is a common file shared by three projects..
Any suggestion ?
Note: If I remove this 'include' line then compiler gives 'unexpected end of line while looking precompiled header file'. I don't want to change 'Use Precompiled Headers' options ( or 'Automatically Generate Precompiled Hedaers' ) because my project is so large and compilation takes so long.
-
December 11th, 2003, 07:55 AM
#2
Perhaps I am missing something, but wouldn't it be better to create a static library of the code that's in the "Common" folder? Then Project1, Project2, and Project3 can all link to that lib. This should also reduce compilation time...
Thought for the day/week/month/year:
Windows System Error 4006:
Replication with a nonconfigured partner is not allowed.
-
December 12th, 2003, 01:57 AM
#3
You may right.
Anyway, I have realised that, the problem is actually not in '#include stdafx.h'. Although it says "No such file ... etc.", the actual problem had been in property of 'stdafx.cpp'. The properties of any .cpp file should be 'Use precompiled headers' and, on the other, the property of stdafx.cpp file [ only this file ] have to be 'Create precompiled header'! That is all.
Still thanks anybody.
Last edited by the one; December 12th, 2003 at 02:03 AM.
-
December 12th, 2003, 07:30 AM
#4
Ah. That would likely have been easier to pinpoint had you posted the exact message that the compiler was giving, rather than
the compiler gives "No such file... ( stdafx.h )" error.
At any rate, I'd still suggest creating a shared library (static or DLL)...
Thought for the day/week/month/year:
Windows System Error 4006:
Replication with a nonconfigured partner is not allowed.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|