I am working on a Managed C++ project and I get the following error:
TestThread.cpp(3) : error C2859: c:\projects\ProjectName\debug\vc70.pdb
is not the pdb file that was used when this precompiled header was
created, recreate the precompiled header.
Why would I get this error? How do I rebuild the precompiled header?
Clean Solution, Rebuild Solution, don't help.
If I manually delete the vc70.pdb, it doesn't seem to recompile. I've
also tried manually compiling stdafx.cpp. I get:
fatal error C1083: Cannot open precompiled header file:
'Debug/ProjectName.pch': No such file or directory
Any help is appreciated.
Managed C++ gets more and more frustrating every day.
This should not be caused, I think, by your use of MC++. Seems like your
project settings got hosed somehow. First, try if you like to disable
precompiled headers (it's in the compiler options in the project settings).
See if that helps at first. If it does, then try setting your settings for
stdafx.cpp to "Create precompiled Header" (/Yc) with stdafx.h, and then set
the rest of the files to "Use Precompiled Header" (/Yu) with stdafx.h. See
if that helps
Sunday, November 1, 2009
C2447: missing function header (old-style formal list?) blog
The following error messages may appear if you try to use the function-try-block syntax.
error C2143: syntax error : missing ';' before 'try'
error C2143: syntax error : missing ';' before 'try'
error C2065: 'ii' : undeclared identifier
error C2143: syntax error : missing ';' before 'try'
error C2448: 'Unknown' : function-style initializer appears to be a function definition
error C2143: syntax error : missing ';' before 'catch'
error C2143: syntax error : missing ';' before '{'
error C2447: missing function header (old-style formal list?)
Back to the top
CAUSEThe compiler does not support the function-try-block syntax as specified in the...The compiler does not support the function-try-block syntax as specified in the C++ Standard (section 15) quoted below:
-3- A function-try-block associates a handler-seq with the ctor-initializer, if present, and the function-body. An exception thrown during the execution of the initializer expressions in the ctor-initializer or during the execution of the function-body transfers control to a handler in a function-try-block in the same way as an exception thrown during the execution of a try-block transfers control to other handler.
Back to the top
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are li...Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Back to the top
MORE INFORMATIONSteps to Reproduce BehaviorThe following code example demonstrates the error: //...Steps to Reproduce Behavior
The following code example demonstrates the error:
//test.cpp
// compiler option needed: /GX
int f(int);
class C {
int i;
public:
C(int);
};
C::C(int ii)
try
: i(f(ii))
{
// constructor function body
}
catch (...)
{
// handles exceptions thrown from the ctor-initializer
// and from the constructor function body
} ID Card Printer in Africa
error C2143: syntax error : missing ';' before 'try'
error C2143: syntax error : missing ';' before 'try'
error C2065: 'ii' : undeclared identifier
error C2143: syntax error : missing ';' before 'try'
error C2448: 'Unknown' : function-style initializer appears to be a function definition
error C2143: syntax error : missing ';' before 'catch'
error C2143: syntax error : missing ';' before '{'
error C2447: missing function header (old-style formal list?)
Back to the top
CAUSEThe compiler does not support the function-try-block syntax as specified in the...The compiler does not support the function-try-block syntax as specified in the C++ Standard (section 15) quoted below:
-3- A function-try-block associates a handler-seq with the ctor-initializer, if present, and the function-body. An exception thrown during the execution of the initializer expressions in the ctor-initializer or during the execution of the function-body transfers control to a handler in a function-try-block in the same way as an exception thrown during the execution of a try-block transfers control to other handler.
Back to the top
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are li...Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Back to the top
MORE INFORMATIONSteps to Reproduce BehaviorThe following code example demonstrates the error: //...Steps to Reproduce Behavior
The following code example demonstrates the error:
//test.cpp
// compiler option needed: /GX
int f(int);
class C {
int i;
public:
C(int);
};
C::C(int ii)
try
: i(f(ii))
{
// constructor function body
}
catch (...)
{
// handles exceptions thrown from the ctor-initializer
// and from the constructor function body
} ID Card Printer in Africa
fatal error C1010 - unexpected end of file while looking for precompiled header directive
Once, when I was trying to compile a program with Visual C++ .NET (dot-net), initially written for the Apple Macintosh for Objective-C. I keep getting the following error message:
"fatal error C1010 - unexpected end of file while looking for precompiled header directive."
I looked into the header file but needed help finding something.
Actually, the answer was simple i solved it by the following way.
MFC programs use many libraries, requiring the use of many header files. To save time, the compiler tries to precompile most of these header files and use the predigested data instead of reading through all of these header files on every compilation. There are several ways to do this. The standard method for MFC programs is to lump all of these standard header file references into one header file ("stdafx.h"). If you just have to ask what "stdafx" means, it comes from the early name of MFC, AFX (application framework).
When compiling each source (.cpp) file, the compiler skips through the source code, looking for the directive:
#include "stdafx.h"
Once it finds this directive, it substitutes the precompiled header information and compiles the rest. If your source file doesn't contain this directive, you get the C1010 error described above.
The simple solution is to insert the include directive to your source file before any other library references or code.
"fatal error C1010 - unexpected end of file while looking for precompiled header directive."
I looked into the header file but needed help finding something.
Actually, the answer was simple i solved it by the following way.
MFC programs use many libraries, requiring the use of many header files. To save time, the compiler tries to precompile most of these header files and use the predigested data instead of reading through all of these header files on every compilation. There are several ways to do this. The standard method for MFC programs is to lump all of these standard header file references into one header file ("stdafx.h"). If you just have to ask what "stdafx" means, it comes from the early name of MFC, AFX (application framework).
When compiling each source (.cpp) file, the compiler skips through the source code, looking for the directive:
#include "stdafx.h"
Once it finds this directive, it substitutes the precompiled header information and compiles the rest. If your source file doesn't contain this directive, you get the C1010 error described above.
The simple solution is to insert the include directive to your source file before any other library references or code.
Subscribe to:
Posts (Atom)