Error in creating graph from point cloud - c++

I am a new user of C++ and point cloud library version 1.6. I would like to generate a graph based on point cloud data. My This is my cpp file:
#include <iostream>
#include <vector>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/common/io.h>
#include <boost/make_shared.hpp>
#include <boost/format.hpp>
#include <pcl/graph/point_cloud_graph.h>
int main (int argc, char** argv)
{
pcl::PointCloud <pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud <pcl::PointXYZ>);
if ( pcl::io::loadPCDFile <pcl::PointXYZ>("xyz_new.pcd", *cloud) == -1 )
{
std::cout << "Cloud reading failed." << std::endl;
return (-1);
}
//create a graph based on the cloud
pcl::graph::point_cloud_graph<pcl::PointXYZ> graph(cloud);
}
However, when I compile it has errors:
Error 1:
C:\Program Files (x86)\PCL 1.6.0\include\pcl-1.6\pcl/graph/point_cloud_graph.h(117): error C2039: 'vertex_bundled' : is not a member of 'boost::vec_adj_list_impl<Graph,Config,Base>'
with
[
Graph=pcl::graph::point_cloud_graph<pcl::PointXYZ>,
Config=boost::detail::adj_list_gen<pcl::graph::point_cloud_graph<pcl::PointXYZ>,boost::vecS,boost::vecS,boost::undirectedS,boost::no_property,boost::no_property,boost::shared_ptr<pcl::PointCloud<pcl::PointXYZ>>,boost::listS>::config,
Base=boost::undirected_graph_helper<boost::detail::adj_list_gen<pcl::graph::point_cloud_graph<pcl::PointXYZ>,boost::vecS,boost::vecS,boost::undirectedS,boost::no_property,boost::no_property,boost::shared_ptr<pcl::PointCloud<pcl::PointXYZ>>,boost::listS>::config>
]
Error2:
C:\Program Files (x86)\PCL 1.6.0\include\pcl-1.6\pcl/graph/point_cloud_graph.h(117): error C2146: syntax error : missing ',' before identifier 'vertex_bundled'
C:\Program Files (x86)\PCL 1.6.0\include\pcl-1.6\pcl/graph/point_cloud_graph.h(117): error C2065: 'vertex_bundled' : undeclared identifier
C:\Program Files (x86)\PCL 1.6.0\include\pcl-1.6\pcl/graph/point_cloud_graph.h(117): error C2955: 'boost::is_same' : use of class template requires template argument list
C:\Program Files (x86)\PCL 1.6.0\3rdParty\Boost\include\boost/type_traits/is_same.hpp(37) : see declaration of 'boost::is_same'
C:\Program Files (x86)\PCL 1.6.0\include\pcl-1.6\pcl/graph/point_cloud_graph.h(117): error C2338: (boost::is_same<typename Base::vertex_bundled, boost::no_property>::value)
File point_cloud_graph.h is from the link: http://taketwo.github.io/tcs/point__cloud__graph_8h_source.html

Related

Boost thread.hpp include error

I am able to include boost libraries in a simple sample project without any problem and it works fine. But as soon as I include #include <boost/thread.hpp> in one of my other project which is already using some other libraries, I am getting the following compilation errors:
1>ClCompile:
1> ThreadManager.cpp
1>C:\Boost\include\boost-1_63\boost/container/container_fwd.hpp(302): warning C4003: not enough actual parameters for macro 'dummy'
1>C:\Boost\include\boost-1_63\boost/container/container_fwd.hpp(302): error C2976: 'atl::Dummy' : too few template arguments
1>C:\program files\adaptive vision\adaptive vision studio 4.3 professional\sdk\include\ATL/Dummy.h(17) : see declaration of 'atl::Dummy'
1>C:\Boost\include\boost-1_63\boost/container/container_fwd.hpp(302): error C3484: syntax error: expected '->' before the return type
1>C:\Boost\include\boost-1_63\boost/container/container_fwd.hpp(302): error C2061: syntax error : identifier 'Get'
1>C:\Boost\include\boost-1_63\boost/container/container_fwd.hpp(302): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
1>
1>Build FAILED.
PS: If I include #include <boost/chrono.hpp> instead of #include <boost/thread.hpp> then there is no error.
PSS: I am using Windows, Visual Studio 2010 (that's why Boost)
Sample Code:
#include <string>
#include <vector>
#include <algorithm>
#include <stdlib.h>
//Header for boost multithreading
//#include <boost/chrono.hpp>
#include <boost/thread.hpp>
namespace avs //Adaptive Vision
{
class MyProgram : public UserFilter
{
int Invoke()
{
//CODE
}
};
}

error: C2039: 'pointer' : is not a member of 'QJsonObject::iterator'

I'm having a weird error when trying to use 'QJsonObject::iterator' with MSVC2013.
I have the following example:
#include <QCoreApplication>
#include <QJsonObject>
#include <QDebug>
#include <algorithm>
void processValue(QJsonValue value) {
qDebug() << value.toString();
}
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QJsonObject jsonObject;
jsonObject.insert("a", "A");
jsonObject.insert("b", "B");
jsonObject.insert("c", "C");
jsonObject.insert("d", "D");
jsonObject.insert("e", "E");
std::for_each (jsonObject.begin(), jsonObject.end(), processValue);
return a.exec();
}
This code compiles and works as expected with MSVC2008 (cross-compiling to WinCE) and MinGW, but not with MSVC2013. In all cases, I'm using Qt 5.5.1.
The error message is:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\xutility(375) : error C2039: 'pointer' : is not a member of 'QJsonObject::iterator'
c:\qt\qt5.5.1msvc\5.5\msvc2013\include\qtcore\qjsonobject.h(96) : see declaration of 'QJsonObject::iterator'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\xutility(584) : see reference to class template instantiation 'std::iterator_traits<_InIt>' being compiled
with
[
_InIt=QJsonObject::iterator
]
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\algorithm(31) : see reference to function template instantiation 'void std::_Debug_range<_InIt>(_InIt,_InIt,std::_Dbfile_t,std::_Dbline_t)' being compiled
with
[
_InIt=QJsonObject::iterator
]
..\QJsonObjectIteratorIssue\main.cpp(21) : see reference to function template instantiation '_Fn1 std::for_each<QJsonObject::iterator,void(__cdecl *)(QJsonValue)>(_InIt,_InIt,_Fn1)' being compiled
with
[
_Fn1=void (__cdecl *)(QJsonValue)
, _InIt=QJsonObject::iterator
]
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\xutility(375) : error C2146: syntax error : missing ';' before identifier 'pointer'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\xutility(375) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\xutility(375) : error C2602: 'std::iterator_traits<_InIt>::pointer' is not a member of a base class of 'std::iterator_traits<_InIt>'
with
[
_InIt=QJsonObject::iterator
]
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\xutility(375) : see declaration of 'std::iterator_traits<_InIt>::pointer'
with
[
_InIt=QJsonObject::iterator
]
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\xutility(375) : error C2868: 'std::iterator_traits<_InIt>::pointer' : illegal syntax for using-declaration; expected qualified-name
with
[
_InIt=QJsonObject::iterator
]
Am I doing anything wrong here, that just happen to work by chance on the 2 other compilers?
Use 5.6 or backport this: https://code.qt.io/cgit/qt/qtbase.git/commit/?id=4a318a61824216ac499ff8b0b0c55dea90501005
QJsonObject::(const_)iterator: add pointer typedef
Otherwise they're unusable with std::algorithms or anything else
that requires iterator_traits.

CGAL Nef_polyhedron compile error in bounding_box_3.h

I am attempting to create a simple test case for Nef_Polyhedron but keep running into a compile error even if there is only one line in the main function and I am not sure what to try next.
Below is my entire program:
#include <iostream>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/Nef_polyhedron_3.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
typedef CGAL::Nef_polyhedron_3<Kernel> Nef_polyhedron;
int main(int argc, char **argv)
{
Nef_polyhedron N0;
}
The errors are as below:
Error 3 error C2039: 'hi' : is not a member of 'CGAL::Box_intersection_d::Box_d<double,3,CGAL::Box_intersection_d::ID_EXPLICIT>' c:\program files\cgal-4.6.2\include\cgal\nef_3\bounding_box_3.h 91 1 CGAL_TEST
Error 1 error C2039: 'lo' : is not a member of 'CGAL::Box_intersection_d::Box_d<double,3,CGAL::Box_intersection_d::ID_EXPLICIT>' c:\program files\cgal-4.6.2\include\cgal\nef_3\bounding_box_3.h 90 1 CGAL_TEST
Error 4 error C2065: 'hi' : undeclared identifier c:\program files\cgal-4.6.2\include\cgal\nef_3\bounding_box_3.h 91 1 CGAL_TEST
Error 2 error C2065: 'lo' : undeclared identifier c:\program files\cgal-4.6.2\include\cgal\nef_3\bounding_box_3.h 90 1 CGAL_TEST
The version of CGAL is 4.6.2.
Any suggestions?

Errors at implementation of SymbolicC++ into existing solution

i'm trying to integrate the SymbolicC++ Library into an already existing solution. My specifications are as followed: Visual Studio 2010 RTM on a Windows 7 OS.
Now my problem:
I already have a solution where I want to integrate a function with symblic variables. There is another previously integrated library (The OMPL "Open Motion Planning Library). If i try to include the symbolicc++.h it fails to compile the solution by these errors:
Error 10 error C2825: '_Fty': must be a class or namespace when followed by '::' c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxresult 28`
Error 11 error C2903: 'result' : symbol is neither a class template nor a function template c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxresult 28
Error 12 error C2039: 'result' : is not a member of '`global namespace'' c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxresult 28
Error 13 error C2143: syntax error : missing ';' before '<' c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxresult 28
Error 14 error C2039: 'type' : is not a member of '`global namespace'' c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxresult 28
Error 15 error C2238: unexpected token(s) preceding ';' c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxresult 28
Error 16 error C2039: '_Type' : is not a member of 'std::tr1::_Result_type2<__formal,_Fty,_Arg0,_Arg1>' c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxresult 40
Error 17 error C2146: syntax error : missing ';' before identifier '_Type' c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxresult 40
Error 18 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxresult 40
Error 19 error C2602: 'std::tr1::_Result_of2<_Fty,_Farg0,_Farg1>::_Type' is not a member of a base class of 'std::tr1::_Result_of2<_Fty,_Farg0,_Farg1>' c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxresult 40
Error 20 error C2868: 'std::tr1::_Result_of2<_Fty,_Farg0,_Farg1>::_Type' : illegal syntax for using-declaration; expected qualified-name c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxresult 40
Error 21 error C2678: binary '==' : no operator found which takes a left-hand operand of type 'std::tr1::_Bind_fty<_Fty,_Ret,_BindN>' (or there is no acceptable conversion) D:\Software\RobotKitV3.0\SensorPluginMotionPlanner\Zusatz\ompl_4_RK\RK_ServerSensor_ompl\RK_ServerSensor_ompl\ServerSensor_ompl.cpp 2587
I am quite sure there is some issue between the two libraries. But i'm not getting it to work properly.
There is one line (which is referred to the Error 21), when I change it from this:
if(bind(serverSocket, (sockaddr*) &addressServer, sizeof(addressServer)) == SOCKET_ERROR)
To this:
if(::bind(serverSocket, (sockaddr*) &addressServer, sizeof(addressServer)) == SOCKET_ERROR)
I don't have these errors anymore! But when i try to start the .exe it fails
with this error:
The application was unable to start correctly (0xc000007b). Click OK to close the application
unless i exclude the line:
#include <symbolicc++.h>
Has somebody an idea to get this work? It's so frustrating that i try to implement the symbolicc++.h since 5 days and can't execute my solution.
Edit:
So I made some progress. If I just comment out everything except this code below there is no error anymore.
#include "stdafx.h"
#include <iostream>
#include <conio.h>
#include <windows.h>
#include <winsock.h>
#include <fstream>
#include <iostream>
#include <string>
#include <WinBase.h>
#include "..\..\SymbolicC++\include\symbolicc++.h"
#include "ServerSensor_ompl.h"
#include <ompl/base/SpaceInformation.h>
#include <ompl/base/spaces/SE3StateSpace.h>
#include <ompl/base/spaces/SE2StateSpace.h>
#include <ompl/base/spaces/SO2StateSpace.h>
#include <ompl/geometric/planners/rrt/RRTConnect.h>
#include <ompl/geometric/SimpleSetup.h>
#include <ompl/config.h>
#include <ompl/geometric/planners/rrt/RRT.h>
#include <ompl/geometric/planners/rrt/RRTConnect.h>
#include <ompl/geometric/planners/rrt/RRTStar.h>
Symbolic Test("Test");
namespace ob = ompl::base;
namespace og = ompl::geometric;
namespace ob_Con_WP = ompl::base;
namespace og_Con_WP = ompl::geometric;
namespace ob_Con_RC = ompl::base; // Robot_Cell
namespace og_Con_RC = ompl::geometric; // Robot_Cell
WSADATA wsa;
struct sockaddr_in addressServer;
int commSocket, serverSocket;
bool RK_active = true;
int m_bufferLength = 0;
int m_bufferLength2 = 0;
const size_t BufferSize = 100000;
char m_buffer[BufferSize];
char m_buffer2[BufferSize];
int Trial_Cart = 0;
int Trial_Joint = 0;
int Trial_Constraint_WP = 0;
int Trial_Constraint_RC = 0;
int Trial_General = 0;
bool Have_Exact_Solution;
std::fstream f;
int countCalls = 0;
int countCallLimit = 1000;
double Constraint_Bounds[2][6];
ob::StateSpacePtr space_Joint(new ob::RealVectorStateSpace(6));
ob::StateSpacePtr space_Cart(new ob::SE3StateSpace);
ob_Con_WP::StateSpacePtr space_Constraint_WP(new ob_Con_WP::RealVectorStateSpace(6));
ob_Con_RC::StateSpacePtr space_Constraint_RC(new ob_Con_RC::RealVectorStateSpace(6));
ob_Con_RC::SpaceInformationPtr si(new ob_Con_RC::SpaceInformation(space_Constraint_RC));
int _tmain(int argc, _TCHAR* argv[])
{
std::cout << "OMPL version: " << OMPL_VERSION << std::endl;
std::cout << std::endl << std::endl;
system("pause");
}
But for example if I try to put this line below into my code the same error (0xc000007B) occurs when I try to execute.
og::SimpleSetup ss_Cart(space_Cart);

C++ Compile error on lines that do not exist

so i'm doing a uni project and when i try to compile a weird error pops up.I've read it might be from circular dependencies but i've checked and thats not the problem here's the header code :
#ifndef __ScheduleHeader_H_INCLUDED__
#define __ScheduleHeader_H_INCLUDED__
#include "TrainStationHeader.h"
class Schedule
{
friend class ScheduleIterator;
public:
//get data functions
std::string getFromCity() { return fromCity; }
std::string getToCity() { return toCity; }
std::string getTrainID() { return trainID; }
std::string getDate();
std::string getTime();
std::string getTimeForTickets();
std::string getPrice() { return price; }
//set data functions + validation on the input data
bool setFromCity();
bool setToCity();
void setDate();
void setTime();
bool setTrainID();
void setPrice();
std::string createScheduleLine();
private:
int validateDate(struct tm,struct tm);
int validateTime(struct tm,struct tm);
std::string scheduleFileName;
std::string fromCity;
std::string toCity;
struct tm dateAndTime;
std::string trainID;
std::string price;
};
#endif
I've added the friend because i have a Schedule object in another class as private.The error when i compile is :
c:\program files (x86)\windows kits\8.0\include\um\schedule.h(60): error C2146: syntax error : missing ';' before identifier 'Type'
1>c:\program files (x86)\windows kits\8.0\include\um\schedule.h(60): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\8.0\include\um\schedule.h(61): error C2146: syntax error : missing ';' before identifier 'Offset'
1>c:\program files (x86)\windows kits\8.0\include\um\schedule.h(61): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\8.0\include\um\schedule.h(68): error C2146: syntax error : missing ';' before identifier 'Size'
1>c:\program files (x86)\windows kits\8.0\include\um\schedule.h(68): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\8.0\include\um\schedule.h(69): error C2146: syntax error : missing ';' before identifier 'Bandwidth'
1>c:\program files (x86)\windows kits\8.0\include\um\schedule.h(69): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\windows kits\8.0\include\um\schedule.h(70): error C2146: syntax error : missing ';' before identifier 'NumberOfSchedules'
1>c:\program files (x86)\windows kits\8.0\include\um\schedule.h(70): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
PS:I'm using MC VS 2012
here's the TrainStation.h , Its just a bunch of functions and libraries i use across the majority of the classes (i know it's not the best practice) :
#ifndef __TrainStation_H_INCLUDED__
#define __TrainStation_H_INCLUDED__
#include <iostream>
#include <string>
#include <fstream>
#include <locale>
#include <iomanip>
#include <ctime>
#include <cstdio>
#include <vector>
std::string removeWhiteSpace(std::string a);
//Resieves the file on wich to operate upon and what to search for.
//If it finds it it returns the line on wich it has been found ,if not returns -1
int checkContent(std::string FileName, std::string target);
//Give the Function the File Name with wich you would like to work and the target that you would like to delete
//It works by copying everything exept the target string to another file then renames it and deletes the old file
int deleteContent(std::string File,std::string target);
void renameFile(std::string , std::string);
bool checkFileState(std::ifstream &file);
#endif
the error message indicates error in "C:\program files (x86)\windows kits\8.0\include\um\schedule.h" that is part of installation of VS or additional SDKs. You quote a completely different header file.
If you can't figure out the error, ask for preprocessor output and read that to see the problem. /SHOWINCLUDES may also help.