2007年3月24日星期六

http://www.quirksmode.org/

http://www.quirksmode.org/

QuirksMode.org is the personal and professional site of Peter-Paul Koch, freelance web developer in Amsterdam, the Netherlands.

It contains about 120 pages with CSS and JavaScript tips and tricks, and is one of the best sources on the WWW for studying and defeating browser incompatibilities. It is free of charge and ads, and largely free of copyrights.

2007年3月23日星期五

How to convert double to string in C++(怎样在C++中将double型数据转化为string类型的数据)

t//first the headers
//必要的头文件
#include <sstream> //for stringstream
#include <string> // for string

// Then the codes :
//源代码如下
double aNumber=12.3866e5;
stringstream aStringstream;
aStringstream<<aNumber;
string aString=aStringstream.str();

实际上,上述方法可以用到任意类型到字符串型的转换。
下面是C++发明者的一个FAQ中的例子。
其实也可以回答很多类似的问题
How do I convert a double number to a string?
How do I convert a float number to a string?

How do I convert an integer to a string?

The simplest way is to use a stringstream:
 #include <iostream>
#include <string>
#include <sstream>
using namespace std;

string itos(int i) // convert int to string
{
stringstream s;
s << i;
return s.str();
}

int main()
{
int i = 127;
string ss = itos(i);
const char* p = ss.c_str();

cout << ss << " " <<p <<"\n";
}
Naturally, this technique works for converting any type that you can output using <<to a string.


下面使用模板来转换任意类型的数据为字符
template <class T>
string toString(T i) // convert i to string
{
stringstream s;
s << i;
return s.str();
}

另一种方法:
Make use of reading and parsing a string in memory. It will also allow data type conversion from a string to the type read.
http://www.yolinux.com/TUTORIALS/LinuxTutorialC++StringClass.html
#include <iostream>
#include <sstream>
#include <string>
using namespace std;

main()
{
string test="AAA 123 SSSSS 3.141592654";
istringstream totalSString( test );
string string1, string2;
int integer1;
double PI;

totalSString > string1 > integer1 > string2 > PI;

cout << "Individual parsed variables:" << endl;
cout << "First string: " << string1 << endl;
cout << "First integer: " << integer1 << endl;
cout << "Value of PI: " << PI << endl;
}

2007年3月22日星期四

DOS Command

Check DOS Command and brief explanation and examples,
see http://timisme1980.googlepages.com/DOS.pdf

2007年3月14日星期三

something about an internationalization tool - .PO and .mo files

A po file example is here: http://svn.automattic.com/wordpress-i18n/pot/trunk/wordpress.pot
The Tools for edit a po file under windows is poEditor, however the website seems not correct any more.
You can check here for detail.
http://poedit.sourceforge.net/
http://www.poedit.org
under Linux is http://gtranslator.sourceforge.net/ and KBabel for KDE.
Here is something for PHP
Internationalization (i18) in PHP/Quercus

ppLinear

Free C/C++ Linear Algebra Library with LU decomposition to solve linear systems and more!
English users can found it in www.pecos-place.com/ppLinear_intro.htm
这是一个线性代数计算的函数库,不是开源的,但是免费提供了Linux和Windows下的链接库文件和头文件。
包括了向量和矩阵两个大类 SVector, SMatrix;可以通过LU分解等方式求解线性代数方程组。

这个库本身是在Visual Stdio 6.0 下编辑的,所以在Windows下很容易操作。

有大量的测试代码可供参考。

可以从这里下载。http://timisme1980.googlepages.com/_ppLinear.rar

All about Google Maps API

You wanna know about Google Maps API, check the homepage of the Google Maps API at
http://www.google.com/apis/maps/

The Wiki of Google Maps API is MapKi at http://mapki.com/wiki/Main_Page
There are some basic examples there at http://www.google.com/apis/maps/documentation/index.html

The official Blog of Google Maps API is http://googlemapsapi.blogspot.com/


Need more, I think you should Google Google Maps API!

2007年3月11日星期日

C++的一些免费库

原文:C++的一些免费库
//整理 by RobinKin (王亮)

* Linear Algebra
o MTL, the Matrix Template Library. Dense and sparse matrices and vectors; banded, symmetric, triangular matrices; basic algorithms. C++.

矩阵模版库,紧密和稀疏矩阵、矢量,带状,对称、三角矩阵,基本算法(C++语言)
o uBLAS, BLAS in C++ with expression templates.

表达式模版形式的 C++中的BLAS ,
o tvmet, a C++ library for "tiny" vectors and matrices with expression templates.

小型矢量和矩阵的表达式模版
o GMM++, generic C++ template library for sparse, dense and skyline matrices, with solvers from ITL.
o MET, a C++ matrix library with expression templates, which eliminates the overhead of overloaded operators.
o SL++, the Scientific Library project. Will provide matrices, random numbers, complex, quaternions, plotting, and FFTs. C++.

科学计算库,提供矩阵、随机数、复数、四元数,快速复利叶变换(C++语言)
o Seldon, C++ library for linear algebra with BLAS interface. Many matrix types (sparse, symmetric, hermitian, etc.) are supported.

BLAS 线性代数接口,支持 稀疏,对称,共轭矩阵
o ALP, linear and polynomial algebra. Vectors, matrices, polynomials.
o SVMT: E. Robert Tisdale's proposal for a standard C++ Scalar, Vector, Matrix and Tensor Class Library (with implementation). Note: this is a proposal, not an official standard.
o GNUSSL [ftp only], the GNU Scientific Software Library. Linear algebra and arrays. C++.
o CPPLapack, C++ wrapper for BLAS and LAPACK.
o Lapack++, C++ wrapper for BLAS and LAPACK.
o IML++ A C++ template library for numerical iterative methods.
o MV++ Numerical Matrix/Vector Classes in C++
o SparseLib++ A library for sparse matrix computations, including the Sparse BLAS (Basic Linear Algebra Subprograms). C++.
o ISIS++, an object-oriented framework for solving sparse linear systems of equations. C++.
o ARPACK++, a C++ template library for solving large-scale standard and generalized eigenvalue problems.
o The Template Numerical Toolkit (TNT) for linear algebra is a successor to the Lapack++, Sparselib++, IML++, and MV++ packages. Its goal is to integrate these ideas into a generic algorithmic library, supporting generic user-defined data types, and increasing its functionality. C++.
o LinAlg, basic linear algebra and optimization classes. C++.
o CAM C++ Class Library (Matrix, vector, and graphics classes)
o Newmat, a C++ matrix library (docs, download)
o CLHEP includes matrix classes, random number generators for the High Energy Physics (HEP) community. C++.
o BPKIT, Block Preconditioning Toolkit for iterative solution of linear systems. Callable from C++, C, or FORTRAN.

* Arrays and Images
o POOMA II framework for scientific computing on sequential and parallel computers. Provides parallel arrays; fields, meshes, particles to come in version 2.1 (June 1999). C++.
o The Blitz++ class library: Array and Vector classes which rival Fortran's performance. C++.
o The AIPS++ Array and Image Classes (Astronomical Information Processing System). C++.
o Daixtrose, a general-purpose expression template engine.
o PETE, an expression templates library -- add expression templates to your own array class.
o SCTL (BlueSail), C++, arrays, matrics, vectors, sparse, rotations.
o VIGRA, generic computer vision/image processing library.
o CPPIMA A C++ image processing library
o LIMP, Large Image Manipulation Program
o Image Restoration and Inpainting, C++ library for image restoration.
o valarray [ftp only], approximation of the valarray class described in Ch. 26 of the ANSI/ISO C++ Standard. Uses expression templates for efficient evaluation.
o Image Understanding Environment (IUE), a DARPA project. C++.
o WAILI, a wavelet transform library in C++.

* Neural Networks, genetic algorithms, machine learning, data mining
o PDP++, a neural-network simulation system written in C++
o EO -- Evolutionary Computation Framework
o CONICAL, C++ classes for building Neural Networks
o GALib, a C++ library for genetic algorithms
o Xelopes data mining library (Java, C++, C#)
o MLC++, Machine learning algorithms and data mining.

* High-Energy Physics and Quantum Chemistry
o QC++, quantum chemistry software in C++, supporting MNDO, AM1 and PM3 models.
o FTensor, C++ class library for tensors.
o GluCat, Clifford algebra template library.
o Computational Thermodynamics Library
o Tech-X has made available C++ libraries related to particle accelerator design.

* Multiprecision, arbitrary precision data types
o NTL, arbitrary length integers, vectors/matrices/polynomials over integers and over finite fields.
o php">EXTNUM, version of double which has the same number of mantissa bits as IEEE 754, but extends the exponent to have range from 10^-646456993 to 10^646456992.
o CLN, an extensive number library. Arbitrary precision integer, float, rational, polynomials, complex, modular integers, transcendental functions, assembly language kernels for some CPUs.
o MUNTL, Multiprecision unsigned number template library (C++).
o MPFUN++, a multiple precision floating point computation package in C++.
o LiDIA, A library for computational number theory. Provides a collection of highly optimized implementations of various multiprecision data types and time-intensive algorithms.
o Apfloat, a C++ High Performance Arbitrary Precision Arithmetic Package
o hfloat, An arbitrary precision package, optimized for very large (> 1000) (decimal) digit numbers.
o fPoint, a C++ class which helps convert floating-point arithmetic to fixed-point arithmetic by recommending range and precision requirements.
o doubledouble, a quad-precision (approximately 30 decimal place) floating point arithmetic class.

* Differential Equations
o Rheoolef, finite element environment in C++.
o EXPDE, a C++ library for solving partial differential equations on semi-unstructured grids. Parallel.
o PZ, a C++ library for finite elements. 1-3 dimensions with hp-adaptivity, continuous or discontinuous, variety of matrix formats.
o MBDyn, multibody dynamics analysis in C++. Built-in parallelization via MPI/Metis.
o P2MESH, 2D finite volume/finite elements, C++ library designed for fast prototyping of high-performance PDE solvers.
o Femlisp, a Common Lisp framework for Finite Element Methods.
o GETFEM++, a C++ finite element library, generic, arbitrary dimensions.
o MOUSE, a C++ library for finite volume computations on unstructured grids.
o DEAL, a C++ library for adaptive finite elements and error estimation. Supports SMPs.
o ODE++, a class library for ordinary differential equations. Explicit and linear-implicit ODE systems, IVP and BVP parameters, various solvers (Runge-Kutta, multistep, BDF). [English] [Deutsch]
o PETSc, object-oriented software for partial differential equations (programmed in C)
o Diffpack, partial differential equations in C++. ($)
o TIDE: Classes for Ordinary Differential Equations. Provides vectors and matrices, extrapolation integrator for ODEs, sparse matrix classes, eigenvalues, shooting for two point BVPs, nonlinear solver, continuation
o BoxLib/CCSE Applications Suite (docs), a class library supporting adaptive mesh refinement (AMR) schemes for computational fluid dynamics.
o OVERTURE, a C++ class library for solving PDEs in complicated domains. Includes adaptive mesh refinement and overlapping grids.
o FEMLIB (ftp, www) A Finite Element package [ftp only] by Michael Tiller (BROKEN LINK, no longer supported)

* Automatic differentiation and interval arithmetic
o Gaol, C++ library for interval arithmetic. Includes methods for interval constraint solvers.
o FADBAD-TADIFF, a C++ package for automatic differentiation using any arithmetic (double or interval) by operator overloading.
o PROFIL/BIAS [English] [Deutsch], a C++ interval arithmetic class library.

* Visualization
o The Visualization Toolkit (vtk), an extensive, free C++ library for scientific visualization.
o VisAD, a Java library for interactive and collaborative visualization and analysis of numerical data
o Java 2D Graph package. Includes contour plots, animation.
o java/ptplot/">Ptplot, a 2D data plotter in Java

* Graph Theory/Combinatorics
o Boost Graph Library, a general purpose, generic C++ library for graph data structures and graph algorithms.
o GTL, the Graph Template Library (C++).
o LEDA, a C++ library for graph theory and combinatorial computing.

* Language interoperability/scripting
o CPPF77 (cppf77.zip), a utility for interfacing C++ and Fortran 77 programs.
o Paul Dubois's code for interfacing Python and C++
o SWIG, generates Perl, Python, Tcl, Java, Eiffel and Guile wrappers for C++ libraries.
o SILOON (Scripting Interface Languages for Object-Oriented Numerics), toolkits and run-time support for building scripting interfaces to existing numerical codes in C, C++, and Fortran. Generates script bindings for Perl, Tcl, and Python.
o Matwrap, a tool which generates C++ wrapper code for matrix-oriented scripting languages such as Matlab 5, Octave, and tela.

* Transforms
o FFTPACK++, a C++ wrapper for FFTPACK complex routines using LAPACK++ Matrix and Vector classes.
o The FXT library of transforms. FFTs, Hartley, Number theoretic, Walsh, others coded in C++.

* Optimization
o COOOL, an object-oriented optimization library
o OptSolve++, a C++ optimization library from Tech-X. (commercial)
o StarFLIP, optimization library for combinatorial problems with fuzzy constraints (C++)
o Javanumeric/index.html">LM (Levenberg-Marquardt) implementation in Java for nonlinear least squares problems.

* Miscellaneous
o GOOSE, GNU Object-Oriented Statistics Environment (C++).
o Borneo, a dialect of the Java language designed to have true support for the IEEE 754 floating point standard.
o SDTS++, a library for manipulating SDTS datasets (geographical information systems)
o Newran, C++ library for generating streams of random numbers.
o Multivariate polynomial interpolation library in C++
o MPI-2 C++ bindings (message passing library for parallel computers)
o CNCL, Communication networks simulation/analysis library (C++).
o OOMF, Object Oriented MicroMagnetic computing Framework at ITL/NIST
o CPPF77, a utility for interfacing C++ and Fortran 77 programs.
o The Standard Template Library (STL)
o The Bench++ Benchmark Suite
o EFLIB: Extended Function Library for Object-Pascal. Generalized arithmetics, equation solvers, more.

* Tools
o TAU (Tuning and Analysis Utilities), explicit instrumentation of C++ libraries for profiling and tracing. For both serial and parallel codes.



Compilers

* Compilers
o KAI C++, an optimizing compiler from Kuck & Associates (now a division of Intel). Unfortunately, this product has been discontinued.
o The free GCC (Gnu Compiler Collection) has a good C++ compiler which can be used under unix or windows (with CygWin).
o Intel's C++ compiler.
o The Portland Group C++ compiler
o The MPC++, a massively parallel, message passing, meta-level processing C++.
o Titanium (free), a dialect of Java for large-scale scientific computing.


Commercial software
o Diffpack, a development framework for multi-physics simulations (C++).
o VectorSpace provides vs.lib (integrable/differentiable objects in C++) and fe.lib (an object-oriented finite element library).
o php">NMath provides vector, matrix, complex numbers and math functions for the .NET platform (e.g. C#)
o macstl, std::valarray implementation using SIMD opcodes (Altivec on PowerPC, SSE/SSE2 on Intel)
o ExacMath library (quad and double-quad precision floating point math), from Floating Point Software.
o Math.h++ and LAPACK.h++ from Rogue Wave Software, Inc (LAPACK.h++ is not the same package as Roldan Pozo's LAPACK++ listed above)
o MtxVec, linear algebra/numerical library for Delphi and C++ Builder.
o Extreme Optimization Library, numerical library for .NET
o MAT (Matlab compatible C++ Matrix Class Library)
o C-XSC: A C++ Class Library for Extended Scientific Computing (A C++ interval methods class library)
o Siscat, C++ software for scattered data approximation
o JNL, A numerical language/library proposal for Java from Visual Numerics.
o LIA,GIA,ICE libraries for interval methods in C++ from Delisoft Ltd. Includes interval arithmetic, global optimization, and solving nonlinear equations.
o AMRES, a C++ library for financial analysis.
Diffpack, a development framework for multi-physics simulations (C++).
* VectorSpace provides vs.lib (integrable/differentiable objects in C++) and fe.lib (an object-oriented finite element library).
* php">NMath provides vector, matrix, complex numbers and math functions for the .NET platform (e.g. C#)
* macstl, std::valarray implementation using SIMD opcodes (Altivec on PowerPC, SSE/SSE2 on Intel)
* ExacMath library (quad and double-quad precision floating point math), from Floating Point Software.
* Math.h++ and LAPACK.h++ from Rogue Wave Software, Inc (LAPACK.h++ is not the same package as Roldan Pozo's LAPACK++ listed above)
* MtxVec, linear algebra/numerical library for Delphi and C++ Builder.
* Extreme Optimization Library, numerical library for .NET
* MAT (Matlab compatible C++ Matrix Class Library)
* C-XSC: A C++ Class Library for Extended Scientific Computing (A C++ interval methods class library)
* Siscat, C++ software for scattered data approximation
* JNL, A numerical language/library proposal for Java from Visual Numerics.
* LIA,GIA,ICE libraries for interval methods in C++ from Delisoft Ltd. Includes interval arithmetic, global optimization, and solving nonlinear equations.
* AMRES, a C++ library for financial analysis.

# KAI C++, an optimizing compiler from Kuck & Associates (now a division of Intel). Unfortunately, this product has been discontinued. The free GCC (Gnu Compiler Collection) has a good C++ compiler which can be used under unix or windows (with CygWin).
# Intel's C++ compiler.
# The Portland Group C++ compiler
# The MPC++, a massively parallel, message passing, meta-level processing C++.
# Titanium (free), a dialect of Java for large-scale scientific computing.


Commercial software

* Diffpack, a development framework for multi-physics simulations (C++).
* VectorSpace provides vs.lib (integrable/differentiable objects in C++) and fe.lib (an object-oriented finite element library).
* php">NMath provides vector, matrix, complex numbers and math functions for the .NET platform (e.g. C#)
* macstl, std::valarray implementation using SIMD opcodes (Altivec on PowerPC, SSE/SSE2 on Intel)
* ExacMath library (quad and double-quad precision floating point math), from Floating Point Software.
* Math.h++ and LAPACK.h++ from Rogue Wave Software, Inc (LAPACK.h++ is not the same package as Roldan Pozo's LAPACK++ listed above)
* MtxVec, linear algebra/numerical library for Delphi and C++ Builder.
* Extreme Optimization Library, numerical library for .NET
* MAT (Matlab compatible C++ Matrix Class Library)
* C-XSC: A C++ Class Library for Extended Scientific Computing (A C++ interval methods class library)
* Siscat, C++ software for scattered data approximation
* JNL, A numerical language/library proposal for Java from Visual Numerics.
* LIA,GIA,ICE libraries for interval methods in C++ from Delisoft Ltd. Includes interval arithmetic, global optimization, and solving nonlinear equations.
* AMRES, a C++ library for financial analysis.

# Diffpack, a development framework for multi-physics simulations (C++). VectorSpace provides vs.lib (integrable/differentiable objects in C++) and fe.lib (an object-oriented finite element library).
# php">NMath provides vector, matrix, complex numbers and math functions for the .NET platform (e.g. C#)
# macstl, std::valarray implementation using SIMD opcodes (Altivec on PowerPC, SSE/SSE2 on Intel)
# ExacMath library (quad and double-quad precision floating point math), from Floating Point Software.
# Math.h++ and LAPACK.h++ from Rogue Wave Software, Inc (LAPACK.h++ is not the same package as Roldan Pozo's LAPACK++ listed above)
# MtxVec, linear algebra/numerical library for Delphi and C++ Builder.
# Extreme Optimization Library, numerical library for .NET
# MAT (Matlab compatible C++ Matrix Class Library)
# C-XSC: A C++ Class Library for Extended Scientific Computing (A C++ interval methods class library)
# Siscat, C++ software for scattered data approximation
# JNL, A numerical language/library proposal for Java from Visual Numerics.
# LIA,GIA,ICE libraries for interval methods in C++ from Delisoft Ltd. Includes interval arithmetic, global optimization, and solving nonlinear equations.
# AMRES, a C++ library for financial analysis.

2007年3月9日星期五

A very useful site ( in Japanese)

http://www.nbrains.net/php/pukiwiki/index.php?NomisoBraaan%20Wiki

NomisoBraaan Wiki - Front Page

脳味噌ぶら~ん ウィキ(NomisoBraaan Wiki) へようこそ!

人気の15件

* OpenGL(29272)
* link集/ライブラリ系(17112)
* link集/開発補助ツール系(17042)
* link集/ライブラリ系/C++(13729)
* link集/DirectX(13534)
* link集/サーバ管理(8819)
* Microsoft VisualC++(8776)
* link集/開発言語系(8743)
* link集/Microsoft関連(8502)
* link集/3D Model Data(8247)
* link集/アプリ系(8003)
* link集/ツール系(7556)
* Microsoft VirtualPC 2004(7070)
* link集/コーディング(6613)
* link集/GIS系

seekg 无效时的处理。

当对ifstream操作,并处理到文件的结尾时,使用fi.seekg(0,ios::beg);无法重新回到fi的开头。
需要执行if(!fi) fi.clear();
然后再执行 fi.seekg(0,ios::beg);才可以正确执行。

2007年3月8日星期四

How to make Microsoft Visual C++ recognize .cc and other file extension.

Following text is COPIED from MSDN.

HOWTO: Make VC++ Recognize File Extensions as C/C++ Files

Q181506


--------------------------------------------------------------------------------
The information in this article applies to:

Microsoft Visual Studio versions 97, 6.0
Microsoft Visual C++, versions 4.0, 4.0a, 4.1
Microsoft Visual C++, 32-bit Enterprise Edition, versions 4.2, 4.2b, 5.0, 6.0
Microsoft Visual C++, 32-bit Professional Edition, versions 4.2, 4.2b, 5.0, 6.0
Microsoft Visual C++, 32-bit Learning Edition, version 6.0

--------------------------------------------------------------------------------
WARNING: Using Registry Editor incorrectly can cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk.

For information about how to edit the registry, view the "Changing Keys and Values" Help topic in Registry Editor (Regedit.exe) or the "Add and Delete Information in the Registry" and "Edit Registry Data" Help topics in Regedt32.exe. Note that you should back up the registry before you edit it. If you are running Windows NT or Windows 2000, you should also update your Emergency Repair Disk (ERD).


SUMMARY
Microsoft's Visual C++ Integrated Development Environment (IDE) recognizes the following file extensions as C++ source files: .c, .cpp, and .cxx. In some cases, a programmer may want to use other file extensions for C++ files; for example, Unix C++ source files often use the .cc extension.

Using the steps in this article, source files with other file extensions may benefit from the Visual C++ IDE's syntax coloring, automatic indentation, and other usage enhancements. This article describes how to automatically compile such files as C/C++ and associate the C++ icon with these files in Windows Explorer.



MORE INFORMATION
The following procedure causes the Visual C++ IDE to recognize extensions other than .c, .cpp, and .cxx as a C/C++ source file. These changes involve altering registry settings.

To start the Registry Editor:

Close any running instances of Developer Studio.


On the Start menu, click Run.


Type regedit and click OK to start the Registry Editor.


In the Registry Editor, repeat the following four steps for each new file extension to associate with a C/C++ icon. These steps illustrate how to associate the .cc file extension with the C++ source file icon:
Right-click HKEY_CLASSES_ROOT and select New | Key.


A key name will appear; change New Key #1 to .cc (the period is mandatory).


Click the new .cc key, then double-click Default in the right-hand pane of the Registry Editor.


In the Value Data field, type cppfile. Click OK.


NOTE: To associate a file extension with the C source file icon, use cfile instead of cppfile. The values hppfile and hfile associate file extensions with C++ and C header file icons, respectively. (In Windows Explorer, the appropriate icon should now accompany files with the extension added in steps 1 through 4. Clicking the icon will launch Visual C++. Don't do this just yet, though.)

The following steps apply to keys and values located on the home key. In the Registry Editor, locate the user settings home key for Developer Studio. For various versions, the home key is:




Version 6.0 (ships with Visual Studio 6.0)

HKEY_CURRENT_USER\Software\Microsoft\DevStudio\6.0\




Version 5.0 (ships with Visual Studio 97)

HKEY_CURRENT_USER\Software\Microsoft\DevStudio\5.0\




Versions 4.x

HKEY_CURRENT_USER\Software\Microsoft\Developer



The following registry keys cause the IDE to load the C/C++ compiler tool for the specified file extensions (.cc illustrated):


Locate the following keys under Build System\Components\Platforms:

Win32(ALPHA)\Tools\C/C++ Compiler for Alpha
Win32(PowerPC)\Tools\C/C++ Compiler for PowerPC
Win32(x86)\Tools\C/C++ Compiler for 80x86

If WinCE 2.0 is installed, the following keys will also be present:

Win32(WCE x86em)\Tools\C++ Compiler for 80x86em (Emulation)
Win32(WCE MIPS)\Tools\C/C++ Compiler Mips R4100
Win32(WCE SH)\Tools\C/C++ Compiler for SH



Each of those keys has a setting called Input_Spec. Double-click Input_Spec; then, in the Value Data field, add ;*.cc to the end of the existing list of extensions. Click OK.


The following registry key determines the file extensions selected for syntax coloring, smart indentation, and so on:


Locate the key Text:

Text Editor\Tabs/Language Settings\C/C++


Double-click the FileExtensions setting; add ;cc to the end of the existing list of extensions. Click OK.


Close the Registry Editor.


Start Developer Studio and create a new file or open an existing one with the extension(s) just added. Syntax coloring and automatic indentation should be in effect.


NOTE: The new extensions will not appear in the Files of type list when you click Open on the File menu. Use All Files (*.*) to view files with nonstandard extensions. Alternatively, double-click the file from Windows Explorer; once it loads into Visual C++, right-click inside the file's window and select Insert File into Project to add the file to a project.

NOTE: External makefiles that are generated from Developer Studio will not have the correct inference rules for new file extensions. Inference rules must be added by either copying existing rules within the makefile (for example, adding SUFFIXES:.cc at the beginning of the makefile and copying the .cpp.obj: rule to create a .cc.obj: rule), or by adding rules in the TOOLS.INI file.

Although the IDE starts the C/C++ compiler tool for the file extensions added in the steps above, the compiler needs to know whether to compile the file as C or C++. The compiler normally compiles .c files as C, and compiles .cpp and .cxx as C++. For all other extensions, the compiler needs an explicit parameter: /TC compiles files as C, /TP compiles files as C++. Each project that includes files with custom extensions needs an explicit /TC or /TP parameter. The following steps illustrate how to do this:

Open a project in Developer Studio.


Click Settings on the Project menu.


In the resulting dialog box, select a configuration and a project (do not select All Configurations or multiple projects).


Click the C/C++ tab.


In the Project Options text box at the bottom, add /TP or /TC to the end of the listed options.


Repeat steps 3 through 5 for each configuration and each project in the workspace whose explicit compile type needs to be set. Click OK.


NOTE: Using /Tp"file.cc" and /Tc"file.cc" nevertheless generates the warnings D4024 and D4027 with VC++ 6.0. However, with the registry changes mentioned here, the file is properly compiled as the type specified. You may disregard the warnings in this case.

This setting treats ALL source files built by the CL compiler tool in the project as C++ (/TP) or C (/TC) files (the project options cannot be edited on a per-file basis). The entire project now uses either the C++ compiler or the C compiler. To treat individual files in a project as C++ or C source files, use the /Tp or /Tc settings. See REFERENCES for more information on the use of compiler settings.

If necessary, a custom build step can launch the C/C++ compiler (CL.EXE) with settings specific to a single file. This is less desirable, because the custom build step requires explicitly listing all of the compiler options. See REFERENCES for online documentation of instructions on adding a custom build step.



REFERENCES
Visual C++ Programmer's Guide, Compiling and Linking, Details, Compiler Reference.

Visual C++, Developer Studio Environment User's Guide, Working With Projects, How Do I... Topics: Working With Projects, Customizing a Build Process.

Additional query words:

Keywords : kbCompiler kbide kbVC400 kbVC410 kbVC420 kbVC500 kbVC600 kbGrpDSTools kbvc600faq
Issue type : kbhowto
Technology : kbVCsearch kbVC400 kbVSsearch kbAudDeveloper kbVC410 kbVC32bitSearch kbVC400a kbVS97 kbVS600 kbVCPE500 kbVCPE600 kbVCPE420b kbVCPE420 kbVCEE500 kbVCEE600 kbVCEE420 kbVCEE420b kbVCLE600


Last Reviewed: May 5, 2001
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.




--------------------------------------------------------------------------------
Send feedback to MSDN.Look here for MSDN Online resources.