c++ - Wheb Build pcl with visual studio 2010 I get point_types.hpp(1185): error C2146: syntax error : missing ';' before identifier 'traits' -
i use pcl library vs 2010. don't use cmake , include dll,libs , include folders.
i wrote simple program populate poitns cloud of hemisphere in pointcloud instance. here super simple code:
#include <iostream> #include <pcl\point_cloud.h> #include <pcl\impl\point_types.hpp> #include <cmath> using namespace pcl; void addpointstocloud(pointcloud<pointxyzrgb>& cloud); int main () { pointcloud<pointxyzrgb> cloud; addpointstocloud(cloud); return 0; } void addpointstocloud(pointcloud<pointxyzrgb>& cloud) { double r =2; int ntheta = 20; //number of grid points double dtheata = 0.5*m_pi / (ntheta - 1); int nphi = 20; double dphi = 2 * m_pi / (nphi - 1); (int = 0 ; < ntheta ; i++ ) { (int j = 0 ; j < nphi ; j++) { double x = r * sin(i*dtheata) * cos(j* dphi ); double y = r * sin(i*dtheata) * sin(j* dphi ); double z = r * cos(i*dtheata); pointxyzrgb p; p.x = x; p.y = y; p.z = z; p.r = static_cast<uint8_t>(255 * x / r); p.g = static_cast<uint8_t>(255 * y / r); p.b = static_cast<uint8_t>(255 * z / r); cloud.push_back(p); } } }
now when build within visual studio 2010 following errors:
error 2 error c2146: syntax error : missing ';' before identifier 'traits' c:\program files (x86)\pcl 1.6.0\include\pcl-1.6\pcl\impl\point_types.hpp 1185
error 3 error c4430: missing type specifier - int assumed. note: c++ not support default-int c:\program files (x86)\pcl 1.6.0\include\pcl-1.6\pcl\impl\point_types.hpp 1185
error 4 error c4430: missing type specifier - int assumed. note: c++ not support default-int c:\program files (x86)\pcl 1.6.0\include\pcl-1.6\pcl\impl\point_types.hpp 1185
i don't understand why, don't have compile errors before building project , is
correct in point_types.hpp (pcl header file)
please me
thank u in advance
i able simplify code error. below code induces error compiler (which gcc error same declaration yours - traits):
did try simplifying code further?
#include <pcl/point_cloud.h> #include <pcl/impl/point_types.hpp> int main () { return 0; }
have @ examples use point_types.hpp in pcl - there none use directly. instead, other things expected set before included. see example: adding own custom pointt type
the last code sample there instead contains following include:
#include <pcl/point_types.h>
point_cloud.hpp included via following include in point_cloud.h (so not need included in application):
#include <pcl/impl/point_types.hpp> // include struct definitions
Comments
Post a Comment