473,395 Members | 1,937 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Precompiled headers problem with 2005

Hi everyone,

I have a strange problem with precompiled headers with VC8. I have the
problem while trying to use a precompiled header to build another
precompiled header. I tried the sample code provided on msdn for the
use of /Yu /Yc and while it works well with VC++ 7.0, it doesn't with
VC++ 8.0 (http://msdn2.microsoft.com/en-us/library/2yzw0wyd.aspx).

It gives me this error under VC 8:
level2.cpp(3) : fatal error C1083: Cannot open precompiled header file:
'level2.pch': The process cannot access the file because it is being
used by another process.
even when level2.pch doesn't exist and I try to change the names so it
would produce another .pch file. So nobody is trying to access
level2.pch.
Those are my sources (minimalist from
http://msdn2.microsoft.com/en-us/lib...yzw0wyd.aspx):

//File stuff.h
#pragma once
class SomeClass {};

//File level1.cpp
#include "stuff.h"
#pragma hdrstop("level1.pch")

//File morestuff.h
//empty

//File level2.cpp (as on msdn)
#include "stuff.h"
#include "morestuff.h"
#pragma hdrstop("level2.pch")
I used (as on msdn):
cl -c -Ycstuff.h -Fplevel1.pch level1.cpp
cl -c -Yustuff.h -Fplevel1.pch -Yc level2.cpp
both in the Visual Studio 2001 and Visual Studio 2005 command prompt
and it breaks with 2005 on the second command line. I also tried to
run it under 2001 after running the batch file that shows the Visual
Studio 2005 command prompt. It also breaks with the error given above.

Note that it's not an environment problem, since running the following
batch file reproduces the problem:

rem Works
call "C:\Program Files\Microsoft Visual Studio
..NET\Common7\Tools\vsvars32.bat"
cl -c -Ycstuff.h -Fplevel1.pch level1.cpp
cl -c -Yustuff.h -Fplevel1.pch -Yc level2.cpp
del level2.pch

rem Error saying that another process is accessing level2.pch.
call "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat"
cl -c -Ycstuff.h -Fplevel1.pch level1.cpp
cl -c -Yustuff.h -Fplevel1.pch -Yc level2.cpp

rem Works, so it's really VC8 locking the file...
call "C:\Program Files\Microsoft Visual Studio
..NET\Common7\Tools\vsvars32.bat"
cl -c -Ycstuff.h -Fplevel1.pch level1.cpp
cl -c -Yustuff.h -Fplevel1.pch -Yc level2.cpp
Thanks in advance
Regards,
Simon

Feb 21 '06 #1
0 1917

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Asfand Yar Qazi | last post by:
Hi, Now that GCC 3.4 has precompiled headers, I'm thinking I can stop using pimpls to speed up development time, as it may make life easier (declaring pimpls takes a long time...) What are...
1
by: JoeS | last post by:
Is there anyway to share a single pch file between projects in VC 7.0? I have 300+ projects each of which creates its own pch. All projects include the exact same header files in the precompiled...
4
by: Andrew Ward | last post by:
Hi All, I was wondering if it is possible to use precompiled headers without having to include a <stdafx.h> or whatever in every source file. My problem is that I have a project that makes heavy...
0
by: Bruno van Dooren | last post by:
Hi, I am working on a dll that exports COM interfaces, and i am having some troubles with the use of precompiled headers. the project compiles always, but if i use /Yu (default: use precompiled...
20
by: Bonj | last post by:
Is it possible to avoid using precompiled headers on files that don't #include "stdafx.h". I have an ATL project,which has got a lot of ATL #includes in its stdafx.h. I now need to add some .c...
1
by: dt | last post by:
Having troubles with my program and i believe it has something to do with my project settings for precompiled headers. This is what i have: my main cpp file, vector.h/cpp and polygon.h/cpp. ...
3
by: Kevin Frey | last post by:
I am working on a test migration of our project to Visual Studio 2005 Beta 2 as a precursor to the availability of the full release of VS2005. The most onerous problem so far concerns the...
0
by: simon_dot_hudon | last post by:
Hi everyone, I have a strange problem with precompiled headers with VC8. I have the problem while trying to use a precompiled header to build another precompiled header. I tried the sample...
8
by: Abubakar | last post by:
Hi, I am writing some unmanaged c++ code that would need to be compiled in the future using compilers other than vc++. I'm using the feature of vc++ "use precompiled headers", is there going to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.