⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 compiling.texi

📁 c++经典教材 Blitz++ v0.8
💻 TEXI
字号:
@node compiling@section Compiling with Blitz++@subsection Header files@cindex header files, convention@cindex @file{blitz} header filesBlitz++ follows an X-windows style convention for header files.  All headersare referred to with a prefix of @file{blitz}.  For example, to use the@code{Array<T,N>} class, one needs to include @code{<blitz/array.h>} insteadof just @code{<array.h>}.  To make this work, the main Blitz++ directorymust be in your include path.  For example, if Blitz++ was installed in@file{/software/Blitz++}, you will need to compile with @code{-I/software/Blitz++}.If you have root privileges, you may want to put in a symbolic link from thestandard include path (e.g. @file{/usr/include/blitz/}) to the @code{blitz}directory of the distribution.  This will allow you to omit the @code{-I...} option when compiling.@subsection Linking to the Blitz++ library@findex libblitz.a@cindex library (@file{libblitz.a})The Blitz++ library file @file{libblitz.a} contains a few pieces of globaldata.  You should ensure that the @file{lib} subdirectory of the Blitz++distribution is in your library path (e.g.@code{-L/usr/local/blitz-0.5/lib}) and include @code{-lblitz} on yourcommand line.  If you use math functions, you should also compile with@code{-lm}.@subsection An example Makefile@cindex makefile, exampleHere is a typical skeletal Makefile for compiling with Blitz++ under gcc:@smallexample@include examples/makefile.example@end smallexampleThere are more example makefiles in the examples, testsuite, and benchmarksdirectories of the distribution.@subsection Explicit instantiation@cindex explicit instantiation@cindex Array explicit instantiationIt is not possible to do explicit instantiation of Blitz++ arrays.  If youaren't familiar with explicit instantiation of templates, then this factwill never bother you.The reason is that explicit instantiation results in all members of a classtemplate being instantiated.  This is @strong{not} the case for implicitinstantiation, in which only required members are instantiated.  The@code{Array<T,N>} class contains members which are not valid for all types@code{T}: for example, the binary AND operation @code{&=} is nonsensical if@code{T=float}.  If you attempt to explicitly instantiate an array class,e.g.@code{template class Array<float,3>;}then you will be rewarded with many compile errors, due to methods such as@code{&=} which are nonsensical for @code{float}.As some consolation, explicit instantiation would not be much help withBlitz++ arrays.  The typical use for explicit instantiation is toinstantiate all the templates you need in one compilation unit, and turn offimplicit instantiation in the others -- to avoid duplicate instantiationsand reduce compile times.  This is only possible if you can predict ahead oftime what needs instantiation.  Easy for simple templates, but impossiblefor classes like @code{Array}.  Almost every line of code you write using@code{Array} will cause a different set of things to be implicitlyinstantiated.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -