在openni中,其版本号由四个数字组成,以一个struct的形式来实现:如下
typedef struct
{
/** Major version number, incremented for major API restructuring. */
int major;
/** Minor version number, incremented when significant new features added. */
int minor;
/** Maintenance build number, incremented for new releases that primarily provide minor bug fixes. */
int maintenance;
/** Build number. Incremented for each new API build. Generally not shown on the installer and download site. */
int build;
} Version;
major.minor.maintenance.build
#include <iostream>
#include "OpenNI.h"
int main()
{
openni::Status result = openni::STATUS_OK;
result = openni::OpenNI::initialize();
if (result == openni::STATUS_OK)
{
openni::Version version = openni::OpenNI::getVersion();
std::cout << version.minor << "."
<< version.major << "."
<< version.maintenance << "."
<< version.build
<< std::endl;
}
openni::OpenNI::shutdown();
system("pause");
return 0;
}
我用的版本是openni 最新版2.2.0.32,四个数字分别对应
那么在程序中得到版本号呢?代码如下:
#include <iostream>
#include "OpenNI.h"
int main()
{
openni::Status result = openni::STATUS_OK;
result = openni::OpenNI::initialize();
if (result == openni::STATUS_OK)
{
openni::Version version = openni::OpenNI::getVersion();
std::cout << version.major << "."
<< version.minor << "."
<< version.maintenance << "."
<< version.build
<< std::endl;
}
openni::OpenNI::shutdown();
system("pause");
return 0;
}