CGAL Nef_polyhedron compile error in bounding_box_3.h - c++

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?

Related

Why is my class object causing undeclared identifier errors?

I am writing a program on Microsoft Visual C++ 2010 Express and am having an issue with my class object. I keep getting undeclared identifier and missing ';' before identifier errors and I'm not sure what is causing the problem.
I've checked my headers for any mistakes and have made several changes to see if it would fix the problem with no luck.
// RightJust class declaration that right justifies the numbers.
#ifdef RIGHTJUST_H_
#define RIGHTJUST_H_
#include "stdafx.h"
#include <iostream>
#include <string>
#include <cstring>
using namespace System;
using namespace std;
class RightJust
{
private:
int x, totalWH1, totalWH2, totalWH3, totalWH4;
int itemT1, itemT2, itemT3, itemT4, itemT5; // Holds item totals
string WH1, WH2, WH3, WH4;
int num[4][5]; // Array containing data
public:
RightJust();
int warehouseLen();
void rightJustZero();
void rightJustLess();
};
// This program asks to user to choose a report type and displays
// the report type chosen.
#include "stdafx.h"
#include <iostream>
#include "RightJust.h"
#include <string>
#include <cstring>
using namespace System;
using namespace std;
int main
{
RightJust type;
if(reportType == 1)
{
type.rightJustZero();
}
else if(reportType == 2)
{
type.rightJustLess();
}
}
I just want a solution to get rid of all the error messages to see if my program is working how I needed it to work.
Test3.cpp
1>Test3.cpp(24): error C2065: 'RightJust' : undeclared identifier
1>Test3.cpp(24): error C2146: syntax error : missing ';' before identifier 'type'
1>Test3.cpp(24): error C2065: 'type' : undeclared identifier
1>Test3.cpp(27): error C2065: 'type' : undeclared identifier
1>Test3.cpp(27): error C2228: left of '.rightJustZero' must have class/struct/union
1> type is ''unknown-type''
1>Test3.cpp(31): error C2065: 'type' : undeclared identifier
1>Test3.cpp(31): error C2228: left of '.rightJustLess' must have class/struct/union
1> type is ''unknown-type''
The include guard in your header is wrong. It should be
#ifndef RIGHTJUST_H_
Using #ifdef RIGHTJUST_H_ will skip the code if the symbol is not defined.
You should not have #include "stdafx.h" in your .h files. And since you seem to be using Visual Studio, you can just use #pragma once instead of the include guard.

Error in creating graph from point cloud

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

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);

Compiling Boost MPL samples on MSVC 2013

Well, I successfully built the test programme:
#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>
int main()
{
using namespace boost::lambda;
typedef std::istream_iterator<int> in;
std::for_each(
in(std::cin), in(), std::cout << (_1 * 3) << " " );
}
but when I tried the one for boost::mpl::map, it barfed:
#include <boost/mpl/map.hpp>
#include <boost/mpl/assert.hpp>
int main()
{
using std::is_same;
using boost::mpl::at;
using boost::mpl::long_;
using boost::mpl::void_;
using boost::mpl::map;
using boost::mpl::pair;
//using namespace boost::mpl;
typedef map <
pair<int, unsigned>
, pair<char, unsigned char>
, pair<long_<5>, char[17]>
, pair < int[42], bool >
> m;
BOOST_MPL_ASSERT_RELATION(size<m>::value, == , 4);
BOOST_MPL_ASSERT_NOT((empty<m>));
BOOST_MPL_ASSERT((is_same< at<m, int>::type, unsigned >));
BOOST_MPL_ASSERT((is_same< at<m, long_<5> >::type, char[17] >));
BOOST_MPL_ASSERT((is_same< at<m, int[42]>::type, bool >));
BOOST_MPL_ASSERT((is_same< at<m, long>::type, void_ >));
return 0;
}
This is the compiler output:
1>------ Build started: Project: example, Configuration: Debug Win32 ------
1> example.cpp
1>c:\projects\example\example\example.cpp(22): error C2027: use of undefined type 'boost::mpl::size<m>'
1>c:\projects\example\example\example.cpp(22): error C2065: 'value' : undeclared identifier
1>c:\projects\example\example\example.cpp(22): error C2975: 'x' : invalid template argument for 'boost::mpl::assert_relation', expected compile-time constant expression
1> c:\boost_1_57_0\boost\mpl\assert.hpp(120) : see declaration of 'x'
1>c:\projects\example\example\example.cpp(22): error C2664: 'int boost::mpl::assertion_failed<0>(boost::mpl::assert<false>::type)' : cannot convert argument 1 from 'boost::mpl::failed ************boost::mpl::assert_relation<0,4,bool boost::mpl::operator ==(boost::mpl::failed,boost::mpl::failed)>::* ***********' to 'boost::mpl::assert<false>::type'
1> No constructor could take the source type, or constructor overload resolution was ambiguous
1>c:\boost_1_57_0\boost\mpl\assert.hpp(176): error C2027: use of undefined type 'boost::mpl::empty<m>'
1> c:\projects\example\example\example.cpp(23) : see reference to class template instantiation 'boost::mpl::assert_arg_pred<boost::mpl::empty<m>>' being compiled
1>c:\boost_1_57_0\boost\mpl\assert.hpp(176): error C2146: syntax error : missing ';' before identifier 'p_type'
1>c:\boost_1_57_0\boost\mpl\assert.hpp(176): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\boost_1_57_0\boost\mpl\assert.hpp(177): error C2653: 'p_type' : is not a class or namespace name
1>c:\boost_1_57_0\boost\mpl\assert.hpp(177): error C2065: 'value' : undeclared identifier
1>c:\boost_1_57_0\boost\mpl\assert.hpp(177): error C2975: 'unnamed-parameter' : invalid template argument for 'boost::mpl::assert_arg_pred_impl', expected compile-time constant expression
1> c:\boost_1_57_0\boost\mpl\assert.hpp(171) : see declaration of 'unnamed-parameter'
1>c:\boost_1_57_0\boost\mpl\assert.hpp(182): error C2027: use of undefined type 'boost::mpl::empty<m>'
1> c:\projects\example\example\example.cpp(23) : see reference to class template instantiation 'boost::mpl::assert_arg_pred_not<boost::mpl::empty<m>>' being compiled
1>c:\boost_1_57_0\boost\mpl\assert.hpp(182): error C2146: syntax error : missing ';' before identifier 'p_type'
1>c:\boost_1_57_0\boost\mpl\assert.hpp(182): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\boost_1_57_0\boost\mpl\assert.hpp(183): error C2653: 'p_type' : is not a class or namespace name
1>c:\boost_1_57_0\boost\mpl\assert.hpp(183): error C2065: 'value' : undeclared identifier
1>c:\boost_1_57_0\boost\mpl\assert.hpp(183): error C2057: expected constant expression
1>c:\boost_1_57_0\boost\mpl\assert.hpp(184): error C2975: 'unnamed-parameter' : invalid template argument for 'boost::mpl::assert_arg_pred_impl', expected compile-time constant expression
1> c:\boost_1_57_0\boost\mpl\assert.hpp(171) : see declaration of 'unnamed-parameter'
1>c:\projects\example\example\example.cpp(23): error C2668: 'boost::mpl::assert_not_arg' : ambiguous call to overloaded function
1> c:\boost_1_57_0\boost\mpl\assert.hpp(203): could be 'boost::mpl::assert<false> boost::mpl::assert_not_arg<boost::mpl::empty<m>>(void (__cdecl *)(Pred),int)'
1> with
1> [
1> Pred=boost::mpl::empty<m>
1> ]
1> c:\boost_1_57_0\boost\mpl\assert.hpp(194): or 'boost::mpl::failed ************boost::mpl::not_<boost::mpl::empty<m>>::* ***********boost::mpl::assert_not_arg<boost::mpl::empty<m>>(void (__cdecl *)(Pred),int)'
1> with
1> [
1> Pred=boost::mpl::empty<m>
1> ]
1> while trying to match the argument list '(void (__cdecl *)(boost::mpl::empty<m>), int)'
1>c:\projects\example\example\example.cpp(25): fatal error C1903: unable to recover from previous error(s); stopping compilation
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Even doing the following:
#include <boost/mpl/map.hpp>
int main()
{
using std::is_same;
using boost::mpl::at;
using boost::mpl::long_;
using boost::mpl::map;
using boost::mpl::pair;
typedef map <
pair<int, unsigned>
, pair<char, unsigned char>
, pair<long_<5>, char[17]>
, pair < int[42], bool >
> m;
at<m, int>::type a;
return 0;
}
fails:
1>------ Build started: Project: example, Configuration: Debug Win32 ------
1> example.cpp
1>c:\projects\example\example\example.cpp(18): error C2027: use of undefined type 'boost::mpl::at<m,int>'
1>c:\projects\example\example\example.cpp(18): error C2065: 'type' : undeclared identifier
1>c:\projects\example\example\example.cpp(18): error C2146: syntax error : missing ';' before identifier 'a'
1>c:\projects\example\example\example.cpp(18): error C2065: 'a' : undeclared identifier
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I've installed VS Community 2013 Update 4. Am I using this incorrectly or is this a failure with the version I've installed? Release notes for 1.57.0 doesn't reference anything, nor does their bug system.
Basically there's a whole slew of missing headers. The last, simplest, one just misses
#include <boost/mpl/at.hpp>
#include <type_traits>
(that's on GCC, so MSVC might require some more due to implementation defined indirect header includes).
The full map sample needs at least
#include <boost/mpl/assert.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/empty.hpp>
#include <boost/mpl/map.hpp>
#include <boost/mpl/size.hpp>
#include <type_traits>
And some more usings:
using boost::mpl::empty;
using boost::mpl::size;

Getting undeclared Identifier errors in Winsock.h

I am trying to compile a code
#include <Header1.h>
#include "Header2..h"
#include <ctype.h>
Header1.h includes winsock.h and Header2.h includes windows.h
I am using winsock.h instead of winsock2.h because winsock2.h was showing redefinition errors, which is a standard error, but I was not able to fix that using the solutions provided to them.
I have also tried including ws2tcpip.h, but it is giving tons of redefinition errors in winsock.h.
I am getting 12 errors in this Module
error C3861: 'close': identifier not found
error C2664: 'setsockopt' : cannot convert parameter 4 from 'timeval *' to 'const char *'
error C2065: 'socklen_t' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'optionLength'
error C2065: 'optionLength' : undeclared identifier
error C2065: 'optionLength' : undeclared identifier
error C2664: 'setsockopt' : cannot convert parameter 4 from 'int32 *' to 'const char *'
error C2065: 'MSG_WAITALL' : undeclared identifier
error C2664: 'recvfrom' : cannot convert parameter 2 from 'uint8 *' to 'char *'
error C2065: 'ERROR_END_OF_STREAM' : undeclared identifier
error C3861: 'close': identifier not found
error C3861: 'close': identifier not found
Add #include <winsock2.h> or #include <ws2tcpip.h> on the top of includes.
#include <winsock2.h>
#include <Header1.h>
#include "Header2.h"
#include <ctype.h>
winsock.h should be included first. And I notice that your code seems to be unixish code. On windows, closesocket is used for closing socket.
Also, #define WIN32_LEAN_AND_MEAN before anything else. That often helps.
Also, in some cases helps this (issues with ws2tcpip identifier error):
#pragma once
#define _WIN32_WINNT 0x500
#include <winsock2.h>
#include <WS2tcpip.h>
#pragma comment(lib, "WS2_32.Lib")