【PCL】x64+VS2013+PCL1.7.2 简便安装与常见LNK2019问题

时间:2021-06-07 19:54:11
 

【PCL】x64+VS2013+PCL1.7.2 简便安装与常见LNK2019问题

分类: PCL 1117人阅读 评论(16) 收藏 举报 PCL

感谢Tsuksa Sugiura

本文使用的安装程序已搬运到墙内 
百度云链接 密码:hsw1

版本:2015/03/18

  • PCL 1.7.2 release
  • Boost 1.57.0
  • Eigen 3.2.4
  • FLANN 1.8.4
  • VTK 6.2.0
  • QHull 2012.1

安装 
修改系统环境变量

添加PCL_ROOT 
值为PCL安装位置 
修改Path 
添加;%PCL_ROOT%\bin;%PCL_ROOT%\3rdParty\FLANN\bin;%PCL_ROOT%\3rdParty\VTK\bin

打开vs2013,新建C++空项目,直接添加cpp文件 
或复制如下代码

<code class="language-C++ hljs lasso has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;"><span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">#include</span> <span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;"><</span>pcl/visualization/cloud_viewer<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>h<span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">></span>
<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">#include</span> <span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;"><</span>iostream<span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">></span>
<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">#include</span> <span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;"><</span>pcl/io/io<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>h<span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">></span>
<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">#include</span> <span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;"><</span>pcl/io/pcd_io<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>h<span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">></span>


int user_data;

<span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">void</span> viewerOneOff(pcl<span class="hljs-tag" style="color: rgb(0, 102, 102); box-sizing: border-box;">::visualization</span><span class="hljs-tag" style="color: rgb(0, 102, 102); box-sizing: border-box;">::PCLVisualizer</span><span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">&</span> viewer)
{
viewer<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>setBackgroundColor(<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1.0</span>, <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0.5</span>, <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1.0</span>);
pcl<span class="hljs-tag" style="color: rgb(0, 102, 102); box-sizing: border-box;">::PointXYZ</span> o;
o<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>x <span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">=</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1.0</span>;
o<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>y <span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">=</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0</span>;
o<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>z <span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">=</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0</span>;
viewer<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>addSphere(o, <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0.25</span>, <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"sphere"</span>, <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0</span>);
std<span class="hljs-tag" style="color: rgb(0, 102, 102); box-sizing: border-box;">::cout</span> <span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;"><<</span> <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"i only run once"</span> <span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;"><<</span> std<span class="hljs-tag" style="color: rgb(0, 102, 102); box-sizing: border-box;">::endl</span>;

}

<span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">void</span> viewerPsycho(pcl<span class="hljs-tag" style="color: rgb(0, 102, 102); box-sizing: border-box;">::visualization</span><span class="hljs-tag" style="color: rgb(0, 102, 102); box-sizing: border-box;">::PCLVisualizer</span><span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">&</span> viewer)
{
static unsigned count <span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">=</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0</span>;
std<span class="hljs-tag" style="color: rgb(0, 102, 102); box-sizing: border-box;">::stringstream</span> ss;
ss <span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;"><<</span> <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"Once per viewer loop: "</span> <span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;"><<</span> count<span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">++</span>;
viewer<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>removeShape(<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"text"</span>, <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0</span>);
viewer<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>addText(ss<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>str(), <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">200</span>, <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">300</span>, <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"text"</span>, <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0</span>);

<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//FIXME: possible race condition here:</span>
user_data<span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">++</span>;
}

int main()
{
pcl<span class="hljs-tag" style="color: rgb(0, 102, 102); box-sizing: border-box;">::PointCloud</span><span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;"><</span>pcl<span class="hljs-tag" style="color: rgb(0, 102, 102); box-sizing: border-box;">::PointXYZRGBA</span><span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">></span><span class="hljs-tag" style="color: rgb(0, 102, 102); box-sizing: border-box;">::Ptr</span> cloud(<span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">new</span> pcl<span class="hljs-tag" style="color: rgb(0, 102, 102); box-sizing: border-box;">::PointCloud</span><span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;"><</span>pcl<span class="hljs-tag" style="color: rgb(0, 102, 102); box-sizing: border-box;">::PointXYZRGBA</span><span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">></span>);
pcl<span class="hljs-tag" style="color: rgb(0, 102, 102); box-sizing: border-box;">::io</span><span class="hljs-tag" style="color: rgb(0, 102, 102); box-sizing: border-box;">::loadPCDFile</span>(<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"example.pcd的位置"</span>, <span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">*</span>cloud);

pcl<span class="hljs-tag" style="color: rgb(0, 102, 102); box-sizing: border-box;">::visualization</span><span class="hljs-tag" style="color: rgb(0, 102, 102); box-sizing: border-box;">::CloudViewer</span> viewer(<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"Cloud Viewer"</span>);

<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//blocks until the cloud is actually rendered</span>
viewer<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>showCloud(cloud);

<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//use the following functions to get access to the underlying more advanced/powerful</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//PCLVisualizer</span>

<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//This will only get called once</span>
viewer<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>runOnVisualizationThreadOnce(viewerOneOff);

<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//This will get called once per visualization iteration</span>
viewer<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>runOnVisualizationThread(viewerPsycho);
<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">while</span> (<span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">!</span>viewer<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">.</span>wasStopped())
{
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//you can also do cool processing here</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//FIXME: Note that this is running in a separate thread from viewerPsycho</span>
<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//and you should guard against race conditions yourself...</span>
user_data<span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">++</span>;
}
<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">return</span> <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0</span>;
}</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li><li style="box-sizing: border-box; padding: 0px 5px;">17</li><li style="box-sizing: border-box; padding: 0px 5px;">18</li><li style="box-sizing: border-box; padding: 0px 5px;">19</li><li style="box-sizing: border-box; padding: 0px 5px;">20</li><li style="box-sizing: border-box; padding: 0px 5px;">21</li><li style="box-sizing: border-box; padding: 0px 5px;">22</li><li style="box-sizing: border-box; padding: 0px 5px;">23</li><li style="box-sizing: border-box; padding: 0px 5px;">24</li><li style="box-sizing: border-box; padding: 0px 5px;">25</li><li style="box-sizing: border-box; padding: 0px 5px;">26</li><li style="box-sizing: border-box; padding: 0px 5px;">27</li><li style="box-sizing: border-box; padding: 0px 5px;">28</li><li style="box-sizing: border-box; padding: 0px 5px;">29</li><li style="box-sizing: border-box; padding: 0px 5px;">30</li><li style="box-sizing: border-box; padding: 0px 5px;">31</li><li style="box-sizing: border-box; padding: 0px 5px;">32</li><li style="box-sizing: border-box; padding: 0px 5px;">33</li><li style="box-sizing: border-box; padding: 0px 5px;">34</li><li style="box-sizing: border-box; padding: 0px 5px;">35</li><li style="box-sizing: border-box; padding: 0px 5px;">36</li><li style="box-sizing: border-box; padding: 0px 5px;">37</li><li style="box-sizing: border-box; padding: 0px 5px;">38</li><li style="box-sizing: border-box; padding: 0px 5px;">39</li><li style="box-sizing: border-box; padding: 0px 5px;">40</li><li style="box-sizing: border-box; padding: 0px 5px;">41</li><li style="box-sizing: border-box; padding: 0px 5px;">42</li><li style="box-sizing: border-box; padding: 0px 5px;">43</li><li style="box-sizing: border-box; padding: 0px 5px;">44</li><li style="box-sizing: border-box; padding: 0px 5px;">45</li><li style="box-sizing: border-box; padding: 0px 5px;">46</li><li style="box-sizing: border-box; padding: 0px 5px;">47</li><li style="box-sizing: border-box; padding: 0px 5px;">48</li><li style="box-sizing: border-box; padding: 0px 5px;">49</li><li style="box-sizing: border-box; padding: 0px 5px;">50</li><li style="box-sizing: border-box; padding: 0px 5px;">51</li><li style="box-sizing: border-box; padding: 0px 5px;">52</li><li style="box-sizing: border-box; padding: 0px 5px;">53</li><li style="box-sizing: border-box; padding: 0px 5px;">54</li><li style="box-sizing: border-box; padding: 0px 5px;">55</li><li style="box-sizing: border-box; padding: 0px 5px;">56</li><li style="box-sizing: border-box; padding: 0px 5px;">57</li><li style="box-sizing: border-box; padding: 0px 5px;">58</li><li style="box-sizing: border-box; padding: 0px 5px;">59</li></ul>

【PCL】x64+VS2013+PCL1.7.2 简便安装与常见LNK2019问题 
选择下载的PCL.props

运行,效果如下: 
【PCL】x64+VS2013+PCL1.7.2 简便安装与常见LNK2019问题

—————————————————————————————

2015.05.08更新 
常见错误 LNK2019: 无法解析的外部符号

1.确实是包含文件 库文件目录写错了 
2.没安装在默认目录 
我遇到 安装在其他盘,然后 error LNK2019 ,error C2039的情况了 
3.安装版本不对 
系统32位,安装的是64的。包诸如此类

————————————————————————————— 
2015.05.14 更新 
关于没有OpenNI

原博主的说法是:

“PCL 1.7.2 seems not stable when including OpenNI2. 
I have updated the PCL All-in-one Installer without OpenNI2. (OpenNI2Grabber is not available. You can use Kinect/Kinect2 Grabber).”

  • KinectGrabber / Kinect2Grabberde的使用:
<code class="language-C++ hljs lasso has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;"><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//#include <pcl/io/openni_grabber.h></span>
<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">#include</span> <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"kinect_grabber.h"</span>

<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//pcl::Grabber* interface = new pcl::OpenNIGrabber();</span>
pcl<span class="hljs-tag" style="color: rgb(0, 102, 102); box-sizing: border-box;">::Grabber</span><span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">*</span> interface <span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">=</span> <span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">new</span> pcl<span class="hljs-tag" style="color: rgb(0, 102, 102); box-sizing: border-box;">::KinectGrabber</span>();</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li></ul>
<code class="hljs lasso has-numbering" style="display: block; padding: 0px; background-color: transparent; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-top-left-radius: 0px; border-top-right-radius: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; word-wrap: normal; background-position: initial initial; background-repeat: initial initial;"><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//#include <pcl/io/openni_grabber.h></span><span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">#include</span> <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"kinect2_grabber.h"</span><span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//pcl::Grabber* interface = new pcl::OpenNIGrabber();</span>pcl<span class="hljs-tag" style="color: rgb(0, 102, 102); box-sizing: border-box;">::Grabber</span><span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">*</span> interface <span class="hljs-subst" style="color: rgb(0, 0, 0); box-sizing: border-box;">=</span> <span class="hljs-literal" style="color: rgb(0, 102, 102); box-sizing: border-box;">new</span> pcl<span class="hljs-tag" style="color: rgb(0, 102, 102); box-sizing: border-box;">::Kinect2Grabber</span>();</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li></ul>

版权声明:本文为博主原创文章,未经博主允许不得转载。