Arabica - an XML parser toolkit written in C++ (SAX in C++)


Arabica is an XML parser toolkit, providing SAX2, DOM and XPath implementations, written in Standard C++.

SAX is an event-based XML processing API. Arabica is a full SAX2 implementation, including the optional interfaces and helper classes. It provides uniform SAX2 wrappers for the expat parser, Xerces, libxml and, on Windows, for the Microsoft XML parser.

The DOM is a platform- and language-neutral interface which models an XML document as a tree of nodes, defined by the W3C. Arabica implements the DOM Level 2 Core on top of the SAX layer.

XPath is a language for addressing parts of an XML document. Arabica implements XPath 1.0 over its DOM implementation.

Arabica is written in Standard C++ and should be portable to most platforms. It is parameterised on string type. Out of the box, it can provide UTF-8 encoded std::strings or UTF-16 encoded std::wstrings, but can easily be customised for arbitrary string types.

Arabica is available for download under a BSD-style license.

F2C - Fortran to C translator



F2C - Fortran to C translator



GSL - GNU科学计算函数库


GSL - GNU Scientific Library

Introduction to GSL

The GNU Scientific Library (GSL) is a numerical library for C and C++ programmers. It is free software under the GNU General Public License.

The library provides a wide range of mathematical routines such as random number generators, special functions and least-squares fitting. There are over 1000 functions in total with an extensive test suite.

The current version is GSL-1.9. It was released on 21 February 2007. This is a stable release.

The complete range of subject areas covered by the library includes,

Complex Numbers Roots of Polynomials Special Functions
Vectors and Matrices Permutations Sorting
BLAS Support Linear Algebra Eigensystems
Fast Fourier Transforms Quadrature Random Numbers
Quasi-Random Sequences Random Distributions Statistics
Histograms N-Tuples Monte Carlo Integration
Simulated Annealing Differential Equations Interpolation
Numerical Differentiation Chebyshev Approximation Series Acceleration
Discrete Hankel Transforms Root-Finding Minimization
Least-Squares Fitting Physical Constants IEEE Floating-Point
Discrete Wavelet Transforms

Unlike the licenses of proprietary numerical libraries the license of GSL does not restrict scientific cooperation. It allows you to share your programs freely with others.

C/C++ User Group Hot Links: 一些资源链接

AI Extreme Programming PalmPilot
Algorithms FAQs Parallel Processing
Animation Filesystems PDF
ASN.1 Finite Automata Persistent Storage
Aspect-Oriented Programming Firewall Pipes
Assembly Language Frameworks PLC
Astronomy Game Development PostScript
ATL Games Random Numbers
Audio Genetic Algorithms Report Writer
Barcodes Geometry RPC
Benchmarks GNU Scientific Apps
Bluetooth Graph Algorithms Simulation
Borland C++ Builder Graphics SMTP
Bug Tracking Graphics Editor SNMP
C Compilers Graphics File Format Software Engineering
C# Graphing Source Code Analysis
C/C++ Interpreters GUI Tools Source Code Control
C++ Certification Gurus Source Code Formatting
C++ Class Design Hardware Spam Tools
C++ Coding Standards Hardware Emulation Speech Recognition
C++ Compilers Hardware Interfacing Spell Checker
C++ Resource Links HP-GL Splines
CAD/CAM HTML Tools Spreadsheet
Calendar IDE Standards
Cartography Image Processing Statistics
CGI IMAP STL Programming
Chat Installation Tools String Classes
COM Instant Messaging Style
Communications Internationalization Template Metaprograms
Compiler Tools Internet Testing
Compression Interpreters Text Editors
CORBA Java Text Utilities
Cross-Platform GUI Java vs. C++ Threads
Cross-Reference Language Tools Training
Curses Linux Translators
Data Mining Localization Tutorials
Data Structures Magazines Typography
Database Mailing Lists UML
DCOM Managed C++ USB
Debugging Marketing Users Group
Design Patterns Math Video
DirectX Math Precision Virtual Machines
Disassembler Memory Allocation Virtual Memory
Disk Utilities MFC Virtual Reality
Documentation Multimedia Wavelets
DOS Extender Network Web browsers
DSP Neural Network Webservers
DVD Newsgroups Windows
Education Apps NNTP Newsreaders Windows CE
Eiffel vs. C++ Office Apps Winsock
Electrical Eng. OOA/OOD WWW
Emailers OpenGL XML
Embedded Systems Operating Systems XWindows
Encryption Operations Research Year 2000

The Object-Oriented Numerics Page


OptSolve++ - 非线性优化


OptSolve++, in development since 1998, quickly brings powerful optimization capabilities to your C++ applications providing developers a more cost effective option than developing from scratch or using unproven solutions. Designed and developed for re-use, OptSolve++ offers a set of scalable and reliable pre-built software libraries that increase your productivity and substantially reduce your schedule and resource risk.

Powerful, standard optimization algorithms; easy-to-use object oriented design
OptSolve++ offers efficient and robust optimization of user-defined merit functions and an easy-to-use object oriented programming API. A canonical interface to the included optimizers is provided, making substituting one optimizer for another straight forward.

Taking full advantage of templating techniques and object-oriented design, OptSolve++ provides maximum flexibility in the choice of argument and return type for the merit function and in the configuration of options for the built-in algorithms.

OptSolve++ allows you to choose between algorithms requiring analytic derivatives and those that do not require gradient information. Functions for estimating numerical derivatives are also available.

With extensible object hierarchies that let you readily implement new algorithms or create a thin interface to existing C or C++ algorithms, OptSolve++ helps accelerate project deployment by reducing the planning, development and testing workload.

OptSolve++ library of nonlinear optimization algorithms

  • Powell - A good choice for problems where the slowness of nonlinear simplex is an issue but a gradient calculation is not available. It is not as robust as nonlinear simplex, but it converges to a solution faster.
  • Conjugate Gradient - Very robust; however, it requires the gradient of the function. A numerical gradient can be used, but as with all numerical approximations accuracy of the solution suffers as a result.
  • Nonlinear Simplex - Very accurate for low-dimensional optimization problems, and since it does not require a gradient calculation it can be used when that information is unavailable or a high-cost function. Nonlinear simplex algorithms are quick to come "in range" of the minimum, but often very slow to provide a high degree of accuracy. This slowness of convergence is a trade off for not using estimations of the function or gradient and the imprecision they include.
  • Levenberg-Marquardt - The de facto standard for nonlinear parametric optimizations.

INI 文件相关内容

INI文件是微软为程序初始化设计的文件格式。这样的文件如系统盘下的Boot.ini, System.ini等。
; a comment line







While it is recommended that programmers should use system registry to store application initialization data, I found myself still using INI files often. I'm not going to discuss or compare the pro's and con's of registry and INI file in detail, but one main reason I use INI files is that, I believe an application should "infect" the system as little as possible, if it could be done by using an INI file, I will not use the registry.


A cross-platform library that provides a simple API to read and write INI-style configuration files. It supports data files in ASCII, MBCS and Unicode. It is designed explicitly to be portable to any platform and has been tested on Windows and Linux. Released as open-source and free using the MIT licence.
How to read/write INI files in VBScript
C# - Read/Write XML files, Config files, INI files, or the Registry

当然,Google 一下你能找到更多:http://www.google.com/search?q=ini+read+write


SQL Performance: Good Practices for Beginners



Most of the developers are like 'accidental developers' and they identify the database performance problems only when the client reports the issues. If you give importants to these guidelines, you can standardise the performance to a stable level. I wrote this article from my own experience and knowledge. Since internet is a wide resource, like most of the professionals I also got such information from the contributions which I read from browsing.

The statements provided here may not be applicable to all the databases since all the features (Eg: Stored Procedures) are not available on all the database systems.

SQL Performance: Good Practices for Beginners

1. Divide your large table to small multiple tables. (In SQL terminology we call it as Normalization)

2. Use the lookup tables. This will help you reduce the overload of tables. Eg: if you have a product-sales table and want to store 3 pictures of the same product, rather than adding three columns to the table use one lookup table. This way you have the freedom to add any number of photos.

3. Also, use only necessary columns. Eg: If you have columns A & B and you have the sum in another column C. Simply, you don't need that C since we can re produce the same table effect with statement SELECT A, B, (A+B) AS C FROM TABLE1.


GoDB - Tech

GoDB Tech 的口号是 Develop Once,Deploy Anywhere。

Linux is growing to be the platform of choice for the future, although there are a number of very powerful tools for developing apps for Linux. It has always been daunting for Windows GUI developers to develop Linux Apps. For example a Windows VB ( Visual Basic ) programmer will have a very tough time developing apps for Linux.

GoDB Changes all that. Now developers can develop Linux apps in familiar Windows . That's right!!! they can use the GoDB IDE in Windows develop the applications debug, simulate and test them in windows and finally deploy them into a Linux machine and the app will run with out any modifications or recompiling. This is made possible by using a GoDB Virtual Machine. When you develop an app using GoDB, your apps will run on all platforms that have the GoDB VM.

Linux developers can also utilize the GoDB Linux IDE for Linux desktops, which can be downloaded freely.

Linux progammers can install the GoDB IDE in their Linux machines, develop and deploy Linux desktop application. The IDE and Linux VM’s are available free for all development and deployment done on Desktop Linux.

Windows developers who are looking to develop Desktop Linux application in their familiar Windows environment can use GoDB Entreprise version in Windows PC to develop and deploy the applications on both the Windows/Linux Desktop.

There are two versions of GoDB for Linux, the X11 version to run GUI apps in XWindows (XFree86) and a version that directly runs on the framebuffer(GUI apps run from the Linux text console).

Here are some screen shots of GoDB Development.

App development using IDE in Windows OR your favourite Linux distro (Using WINE - for more information read "SETUP.TXT")


James Clark's Home Page - Something about XML

James Clark的个人主页上有一些关于XML的链接,包括一个XML Parser和用来测试XML Parser的标准XML文件集合。

XML Resources

TREX, a new, simple schema language for XML

The specification of a subset of XML called Canonical XML for use in testing XML parsers.

A collection of test cases for testing XML parsers. The valid test cases in the collection include the corresponding canonical XML.

A Java program XMLTest which generates canonical XML. This uses David Megginson's SAX API, and can be used with any parser which has a SAX driver.

XP, a high-performance XML parser in Java

Expat (XML Parser Toolkit), a library for XML parsing in C. This is the parser being used to add XML support to Netscape 5 and Perl. There are answers to some frequently asked questions about expat. There's also a useful article on expat at XML.com.

SP, which has enhanced XML support in version 1.3 both for parsing XML and for converting SGML to XML.

XT is an implementation in Java of XSL Transformations (XSLT).

XSLT in Perspective, slides for a talk on XSLT (collected into a single HTML page).

XML Namespaces, an explanation of the XML Namespaces Recommendation.

The Unicode Character Code Charts By Script

The Unicode Character Code Charts By Script


Internationalization Using Standard C++


Internationalization Using Standard C++

C/C++ User Journal, September 1997
Klaus Kreft & Angelika Langer


Computer users all over the world prefer to interact with their systems using their own language and cultural conventions. Cultural differences affect for instance the display of monetary values, of date and time. Just think of the way numeric values are formatted in different cultures: 1,000,000.00 in the US is 1.000.000,00 in Germany and 10,00,000.00 in Nepal. If you aim for high international acceptance of your products you must build into your software the flexibility to adapt to varying requirements that stem from cultural differences. Building into software the potential for worldwide use is called internationalization . It is one of the challenges of software development in these days.

Traditionally, internationalization was achieved by means of C. Standards like POSIX and X/Open define locales and wide character input and output for standard C. Windows 95 and Windows NT have a C interface, too, the Win32 NLSAPI. None of the Win32 NLSAPI interfaces matches any of the standard C interfaces though, and locales are thread-specific in Windows whereas they are provided per process in Unix. These are important differences. The concept and level of support, however, is equivalent. There is a common notion of locales, and the services provided cover almost the same range of i18n problems. Naturally, C++ cannot stand back. The ISO/ANSI C++ standard defines an extensible framework that facilitates internationalization of C++ programs in a portable manner. Its main elements are locales and facets . This article gives an overview of the locale framework and the standard facets defined by ISO/ANSI C++.

DebugView - 程序调试用的免费软件

DebugView is an application that lets you monitor debug output on your local system, or any computer on the network that you can reach via TCP/IP. It is capable of displaying both kernel-mode and Win32 debug output, so you don't need a debugger to catch the debug output your applications or device drivers generate, nor do you need to modify your applications or drivers to use non-standard debug output APIs.

DebugView works on Windows 95, 98, Me, 2000, XP, Windows Server 2003, Windows for x64 processors and Windows Vista.

A Comparative Overview of C# - 一篇C#与各种语言的比较的文章

A Comparative Overview of C#

Author: Ben Albahari
Date: Released 31 July 2000, updated 10 August 2000.
Acknowledgements (alphabetically): Don Box, C.R. Manning, Joe Nalewabau, John Osborn, Thomas Rhode & Daryl Richter for their feedback and support

This article focuses on the new ways of programming C# offers, and how it intends to improve upon its two closest neighbors, Java and C++. C# improves on C++ in a similar way to Java in many respects, so I'm not going to be re-explaining things like the benefits of a single-rooted object hierarchy. This article begins with a brief summary of the similarities between C# and Java, and then goes into exploring the new C# features.



Visual C# 2005 Express


SharpDevelop - #Develop 开源的C#IDE


MonoDevelop - Linux GNOME下的C# IDE

MonoDevelop is a free GNOME IDE primarily designed for C# and other .NET languages. The main features of MonoDevelop are:

* Code Completion. MonoDevelop's intelligent code completion attempts to complete type, method and field names as you're typing. The IDE will automatically get the class information from your source code files and from the libraries referenced in your project.

* Class Management. MonoDevelop has a class viewer which allows you to list the classes in your project, their methods, and properties. Your namespaces are also kept track of to keep the classes separated.

* Built-in Help. The .NET documentation and the Gtk# documentation are built into MonoDevelop for easy access.

* Project Support. MonoDevelop comes with built in projects that help get you started with your console, Gnome# or Gtk# application.

* Add-ins. MonoDevelop has a powerful add-in engine, which together with a modular API and a complete set of extension points, provides a seamless platform upon which to build your own development tools. MonoDevelop also provides an Add-in Manager you can use to install add-ins from online repositories.


C# Studio is a simple IDE for a C#/Mono/GTK# developer. It has a standard "project/editor/output" interface (screenshot 1 and screenshot 2).

The latest and greatest version is 0.1. The CVS access and online CVS is also available.

If you have any questions feel free to ask them in C# Studio mailing list (you must be subscribed to post to the list). If you found a bug then filing a bug report is the best way to get it fixed.


Keyword 网站业务关键字

Google Adwords的关键字工具
1. 关键字的相关数据(某个关键字及相关关键词的检索次数,以及广告商的竞争程度)
2. 某个网站对应的关键字

キーワードアドバイスツール プロ 专业的关键字建议

* キーワードアドバイスツールプロは検索エンジンマーケティング担当者のための無料ツールです。指定した検索キーワードの、Google、Yahoo!、 Live Search (MSNサーチ)合算の予想月間検索回数を表示します。選択した国・地域に応じて予測検索数を調整してあります。
* 各検索エンジンの検索回数は、当該キーワードのSERPsにリンクしています。

SEOSEO.net 关键字热门程度

muParser - Fast mathematical expressions parser


Many applications require the parsing of mathematical expressions. The main objective of this project is to provide a fast and easy way of doing this. muParser is an extensible high performance math parser library. It is based on transforming an expression into a bytecode and precalculating constant parts of it.

The math parser library is written in pure C++ and should compile on every standard compliant compiler. I provide you with static libraries and a DLL version ready for implementation into your projects. The code has been tested using MS VC++ V7.1 and GCC V3.3.1. It reportedly works on BCB too. I provide you with three demo projects in order to help you understand its usage.

But before I go on, I'd like to thank SourceForge for hosting this project. This pages would not exist without the webspace provided by them and of course I'd like to thank CodeProject for hosting the original math parser article.

CodeProject 上的一个介绍性的文章,包含示例代码和说明的下载。

Error with muParser and Visual C++ 2005 Express Edition

No error or warning during compile and build period.
When I run the problem(debug mode) and when it goes to mu::Parser myParser;
There is an error like this:

Windows has triggered a breakpoint in cascade.exe.

This may be due to a corruption of the heap, and indicates a bug in myParser.exe or any of the DLLs it has loaded.

The output window may have more diagnostic information.

The debug run stops at a xutility file which is a "xutility internal header".
If I continue the run, finally the following error occurs!

Debug Assertion Failed!
Program: ...
File: dbgdel.cpp
Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
For information on how your program can cause an assertion failure, see the Visual C++ documention on asserts.

However, the Release run is ok.

And the codes works well in Visual C++ 6.0 under Debug and Release mode!

I am searching the method to cop with this.
... something is being deleted twice. When ever you do a delete, be sure to set the pointer to 0 so a second delete will not cause issue.

writing into unallocated memory (either on the heap or on the stack).

But the above advice seems not useful!


TNT - Template Numerical Toolkit







The Template Numerical Toolkit (TNT) is a collection of interfaces and reference implementations of numerical objects useful for scientific computing in C++. The toolkit defines interfaces for basic data structures, such as multidimensional arrays and sparse matrices, commonly used in numerical applications. The goal of this package is to provide reusable software components that address many of the portability and maintennace problems with C++ codes.

TNT provides a distinction between interfaces and implementations of TNT components. For example, there is a TNT interface for two-dimensional arrays which describes how individual elements are accessed and how certain information, such as the array dimensions, can be used in algorithms; however, there can be several implementations of such an interface: one that uses expression templates, or one that uses BLAS kernels, or another that is instrumented to provide debugging information. By specifying only the interface, applications codes may utilize such algorithms, while giving library developers the greatest flexibility in employing optimization or portability strategies.

What next?

* take a quick look at the examples to see how arrays are used in TNT.
* browse the Overview section to see what TNT offers.
* consult the on-line Documentation for a detailed description of data structures and algorithms.
* Download the source code and documentation.

NUnit - Unit Testing for .NET

.NET的Unit Testing测试框架,就像Java有JUnit一样。

MinGW Developer Studio

一个跨平台的C/C++ IDE,集成开发环境。不但可以在Windows下编辑GTK,wxWidget程序,还可以在Linux,Unix等系统下工作。


MinGW Developer Studio

MinGW Developer Studio is a C/C++ IDE(Integrated Development Environment) for MinGW port of GNU GCC Compiler system for Microsoft Windows. Also it has been ported to Linux and FreeBSD as well.

* More infomation
* Download

Toolkit for Advanced Optimization (TAO)


The TAO project focuses on the development of software for large-scale optimization problems. TAO uses an object-oriented design to create a flexible toolkit with strong emphasis on the reuse of external tools where appropriate. Our design enables bi-directional connection to lower level linear algebra support (for example, parallel sparse matrix data structures) as well as higher level application frameworks.

The Toolkit for Advanced Optimization (TAO) is aimed at the solution of large-scale optimization problems on high-performance architectures. Our main goals are portability, performance, scalable parallelism, and an interface independent of the architecture.

TAO is suitable for both single-processor and massively-parallel architectures. The current version of TAO has algorithms for unconstrained and bound-constrained optimization. We are working on extending the toolkit to nonlinearly constrained problems.

TAO is funded through the Department of Energy's Office of Science (MICS Division) and is part of the ACTS Toolkit .

libMesh - 串并行平台下求解PDE的C++ 数值计算库


The libMesh library is a C++ framework for the numerical simulation of partial differential equations on serial and parallel platforms. Development began in March 2002 with the intent of providing a friendly interface to a number of high-quality software packages that are publicly available. Currently the library supports 1D, 2D, and 3D steady and transient finite element and finite volume simulations. PETSc is currently used for the solution of linear systems on both serial and parallel platforms, and LASPack is included with the library to provide linear solver support on serial machines. An optional interface to SLEPc is also provided for solving both standard and generalized eigenvalue problems.

The libMesh library is actively developed at The University of Texas at Austin in the CFDLab and at Technische Universität Hamburg-Harburg, Modelling and Computation in Germany. Many thanks to SourceForge for hosting the project. You can find out what is currently happening in the development branch by checking out the CVS Logs online.

A major goal of the library is to provide support for adaptive mesh refinement (AMR) computations in parallel while allowing a research scientist to focus on the physics they are modeling. The library makes use of high-quality, existing software whenever possible. A complete list of external applications used in the library may be found here.

FLENS - a flexible library for efficient numerical solutions in C++

FLENS - a Flexible Library for Efficient Numerical Solutions in C++

Aims and Scopes

FLENS aims at setting up a base for the implementation of flexible, yet efficient solutions for various numerical problems. We are developing FLENS at the Department of Numerical Analysis at the University of Ulm. The software is proposed to be used in research and for teaching purposes. These two areas of application pose completely different requirements for the software: Efficieny and convenient usage. Though considered conflicting goals by most people, we think our software fullfills both requirements. Modern software engineering techniques - like static polymorphism through templates - provide the neccessary means. The price we have to pay, is the usage of compilers being standard conforming to a high degree (gcc 3.3, icc 7.1, Comeau 4.301 or higher).

Application in research: The main field of application of our library will be the realization of adaptive numerical methods, which is one of the main areas of research in our department, particularly adaptive wavelet methods for elliptic PDEs. This exposes high efficiency requirements on the library and also demands good preparation for rapid prototyping and extension. The "why yet another numerical library? - argument" can be answered with a look at the specific requirements of adaptive numerical methods. Here finite dense or sparsely populated matrices and vectors which most existing software offers, are just not sufficient. We also have to provide infinite dimensioned vectors and matrices. But in an linear equation like Ax=b the user interface shall be the same regardless if A is finite dimensioned or an infinite operator (though the internal realization of course differs).

Application in teaching: The library shall also be used as a generic numerical toolbox for teaching purposes. This enforces convenient and intuitive usage to make the library become a tool accepted and hopefully liked by students. In undergraduate classes topics like interpolation, numerical integration and systems of linear systems will be covered. More advanced graduate class students are introduced to numerical partial differential equations. Therefore the library has to offer a wide range of numerical mehtods.


  • flexible and extendible matrix and vector types.
  • efficient, yet convenient syntax.
  • solvers for linear equations.
  • mathematical oriented operator notation.
  • fast access to matrix and vector parts.
  • 100% C++-standard conforming.



Techniques for Scientific C++

Techniques for Scientific C++

Todd Veldhuizen

Indiana University Computer Science Technical Report # 542
Version 0.4, August 2000

This report summarizes useful techniques for implementing scientific programs in C++, with an emphasis on using templates to improve performance.

NT2 - Numerical Template Toolbox


NT² is an Open Source C++ library providing various template matrix classes that can be used with a Matlab™ like syntax whose performances are close to those obtained with hand written C code. Based on a wide usage of advanced template techniques, this library provides various numerical toolboxes like linear algebra, polynom or optimisation.



Linux Inside Windows with database support and tomcat



Using Linux Inside Windows to get started with ASP.NET on Linux


If you’re not yet ready to start installing, administering and configuring a full-blown Linux® distro there’s a new alternative called Linux Inside Windows (LIW), and it's available for download from the Grasshopper Web site. LIW will allow you to check out how your Grasshopper applications can run on Linux, while still using your Windows® system.

Figure 1. Running Linux Inside Windows.

LIW is an application based on the QEMU project, which is an open source processor emulator that can be used to run a virtual Linux machine. LIW has taken the QEMU project and added a Debian GNU/Linux system to it, along with Tomcat and PostgreSQL. LIW can happily run applications that you build using Grasshopper. This article describes how to download and install LIW, and then build and run your first J2EE™ application on Linux Inside Windows!

Use Anthem.NET AJAX Toolkit In Your J2EE Application


Use Anthem.NET AJAX Toolkit In Your J2EE Application

Use Grasshopper and the Anthem.NET AJAX toolkit to develop feature-rich Web applications that run on J2EE!


Anthem.NET is a powerful, open source AJAX toolkit for the ASP.NET and ASP.NET 2.0 development environments. Using Anthem.NET, you can create a highly interactive, highly responsive, feature-rich Web application using view state, server-side events, and everything else you would typically use to create an ASP.NET application. Now, with Mainsoft's cross-compilation product suite, you can recompile your Web application to Java bytecode and deploy it on your preferred J2EE application server. Handy? We think so!


Precompiled Headers 预编译头文件

终于搞懂了,预编译头文件(precompiled header)
提供者:pyl2001 张贴时间:2004-03-09 19:32:16.0





fatal error C1083: Cannot open precompiled header file: \'Debug/v13_3.pch\':

No such file or directory

怎么rebuild all都不行。





2。写一个preh.c,里面只一句话:#include "preh.h"

3。对于preh.c,在project setting里面设置creat precompiled headers,对于其他

.c文件,设置use precompiled header file



我试了一下,效果很明显,不用precompiled header,编译一次我可以去上个厕所,用

precompiled header,编译的时候,我可以站起来伸个懒腰,活动活动就差不多啦









也许你会问:现在的编译器都有Time stamp的功能,编译器在编译整个工程的时候,它




头文件中的东西(.eg Macro, Preprocesser )都要重新处理一遍。VC的预编译头文件








想必大家都知道 StdAfx.h这个文件。很多人都认为这是VC提供的一个“系统级别”的


典型的由AppWizard生成的MFC Dialog Based 程序的预编译头文件。(因为AppWizard



#include // MFC core and standard components

#include // MFC extensions

#include // MFC Automation classes

#include // MFC support for Internet Explorer 4

Common Controls





们还需要一个cpp文件来生成.pch 文件。这个文件默认的就是StdAfx.cpp。在这个文件

里只有一句代码就是:#include “Stdafx.h”。原因是理所当然的,我们仅仅是要它能



开project ->Setting->C/C++ 对话框。把Category指向Precompiled Header。在左边的


Project Options(右下角的那个白的地方)可以看到 /Fp “debug/PCH.pch”,这就是指

定生成的.pch文件的名字,默认的通常是 <工程名>.pch(我的示例工程名就是PCH)。


这时原来的Project Option变成了 Source File Option(原来是工程,现在是一个文件

,当然变了)。在这里我们可以看到 /Yc开关,/Yc的作用就是指定这个文件来创建一个


件的可以有YC开关。VC就根据这个选项把 StdAfx.cpp编译成一个Obj文件和一个PCH文件


在这里,Precomplier 选择了 Use ⋯⋯⋯一项,头文件是我们指定创建PCH 文件的stda






是最开头,包含 你指定产生pch文件的.h文件(默认是stdafx.h)不然就会有问题。如

果你没有包含这个文件,就告诉你Unexpected file end. 如果你不是在最开头包含的,


fatal error C1010: unexpected end of file while looking for precompiled

header directive

Generating Code...


的分析,你只要让编译器生成一个pch文件。也就是说把 stdafx.cpp(即指定/Yc的那个

cpp文件)从新编译一遍。当然你可以傻傻的 Rebuild All。简单一点就是选择那个cpp

文件,按一下Ctrl + F7就可以了。不然可是很浪费时间的哦。





tsshutdn -reboot