473,545 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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\T ools\vsvars32.b at"
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\T ools\vsvars32.b at"
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 1929

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

Similar topics

6
2178
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 the views of the experienced users of various C++ implementations? Do precompiled headers allow pimpls to be avoided while maintaining the same speed...
1
3649
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 header. Its takes about 7 seconds to create the precompiled header for each project. That's 35 minutes spent creating precompiled headers for all...
4
2505
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 usage of a large third party library which means after pre-processing each translation unit is around 1meg in size. There are reasons though why I...
0
1193
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 header) i get linker error: OPCServer.exp : warning LNK4070: /OUT:OPCServer.dll directive in .EXP differs from output filename...
20
1612
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 files to this project, that compile as hard raw C - not C++. The .c files obviously won't understand the <atlbase.h> etc that are in the stdafx.h....
1
1199
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. vector.h includes math, polygon includes vector and gl/gl.h, and main includes windows.h, gl/gl.h, gl/glu.h, gl/glaux.h and polygon.h i've tried...
3
1914
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 requirement by LINK.EXE that if an object file has used precompiled headers, then the resulting "precompiled header object file" must also be one of the...
0
328
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 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...
8
1466
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 be any problem if I compile this code on other compilers? I'm asking this because when I use pch *some* of my cpp files has following as there first...
0
7490
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7425
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7935
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7449
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5351
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3479
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3465
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1911
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
734
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.