22 Şubat 2018 Perşembe

version

Giriş
Şu satırı dahil ederiz.
#include <boost/version.hpp>
BOOST_LIB_VERSION
Örnek
Şöyle yaparız.
std::cout << "boost version: " << BOOST_LIB_VERSION << std::endl;
Çıktı olarak şunu alırız.
boost version: 1_46_1
Örnek
Çıktı olarak şunu alırız.
1_64
Örnek
Şöyle yaparız.
#include<boost/version.hpp>
#include <iostream>

using namespace std;

int main() {
  cout << "My first boost program with version:" <<BOOST_LIB_VERSION<< endl;
  return 0;
}
Çıktı olarak şunu alırız.
My first boost program with version:1_33_1
BOOST_VERSION
Açıklaması şöyle.
// Caution, this is the only boost header that is guarenteed
// to change with every boost release, including this header
// will cause a recompile every time a new boost version is
// released.
//
// BOOST_VERSION % 100 is the patch level
// BOOST_VERSION / 100 % 1000 is the minor version
// BOOST_VERSION / 100000 is the major version
106400 gibi bir çıktı verir.
Örnek
Şöyle yaparız.
#if BOOST_VERSION >= 106100
  #include <this.hpp>
#else
  #include <that.hpp> 
#endif
Örnek
Şöyle yaparız.
std::cout << "Using Boost "
    << BOOST_VERSION / 100000     << "."  // major version
    << BOOST_VERSION / 100 % 1000 << "."  // minor version
    << BOOST_VERSION % 100                // patch level
    << std::endl;
Örnek
Şöyle yaparız
#include <boost/version.hpp>
#include <boost/config.hpp>
#include <iostream>

int main() {
  std::cout << "BOOST_VERSION           " << BOOST_VERSION           << "\n";
  std::cout << "BOOST_LIB_VERSION       " << BOOST_LIB_VERSION       << "\n";
  std::cout << "BOOST_PLATFORM          " << BOOST_PLATFORM          << "\n";
  std::cout << "BOOST_PLATFORM_CONFIG   " << BOOST_PLATFORM_CONFIG   << "\n";
  std::cout << "BOOST_COMPILER          " << BOOST_COMPILER          << "\n";
  #ifdef BOOST_LIBSTDCXX_VERSION
    std::cout << "BOOST_LIBSTDCXX_VERSION " << BOOST_LIBSTDCXX_VERSION << "\n";
  #endif
  #ifdef BOOST_LIBSTDCXX11
    std::cout << "Compiled with c++11 support enabled\n";
  #endif
  std::cout << "BOOST_STDLIB            " << BOOST_STDLIB            << "\n";
  std::cout << "BOOST_STDLIB_CONFIG     " << BOOST_STDLIB_CONFIG     << "\n";
}
Çıktı olarak şunu alırız
BOOST_VERSION           106400
BOOST_LIB_VERSION       1_64
BOOST_PLATFORM          linux
BOOST_PLATFORM_CONFIG   boost/config/platform/linux.hpp
BOOST_COMPILER          Clang version 3.8.0 (tags/RELEASE_380/final 263969)
BOOST_STDLIB            libc++ version 1101
BOOST_STDLIB_CONFIG     boost/config/stdlib/libcpp.hpp
Çıktı olarak şunu alırız
BOOST_VERSION           106500
BOOST_LIB_VERSION       1_65
BOOST_PLATFORM          linux
BOOST_PLATFORM_CONFIG   boost/config/platform/linux.hpp
BOOST_COMPILER          GNU C++ version 7.2.0
BOOST_LIBSTDCXX_VERSION 70200
Compiled with c++11 support enabled
BOOST_STDLIB            GNU libstdc++ version 20170818
BOOST_STDLIB_CONFIG     boost/config/stdlib/libstdcpp3.hpp



Hiç yorum yok:

Yorum Gönder