您的位置:首页 > 运维架构

输出openni版本号

2013-10-31 11:31 281 查看
在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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: