Nice day to all!
I try to compile a little example from boost docs pdf's:
#include "boost/icl/interval.hpp"
#include "boost/icl/interval_set.hpp"
#include "boost/date_time/posix_time/posix_time_duration.hpp"
#include <boost/icl/ptime.hpp>
#include <boost/date_time.hpp>
#include <iostream>
#include <string>
using namespace std;
using namespace boost;
using namespace boost::icl;
using namespace boost::posix_time;
using namespace boost::gregorian;
...
interval<boost::posix_time::seconds>::type news(seconds(), make_seconds("20:15:00"));
interval<seconds>::type talk_show(make_seconds("22:45:30"), make_seconds("23:30:50"));
interval_set<seconds> myTvProgram;
myTvProgram.add(news).add(talk_show);
// Iterating over elements (seconds) would be silly ...
for(interval_set<seconds>::iterator telecast = myTvProgram.begin();
telecast != myTvProgram.end(); ++telecast)
//...so this iterates over
return 0;
I've error:
error C3861: 'make_seconds': identifier not found
How to make correct convert? Thanks.
Related
I'm using openCV-3.2.0 and getting an identifier undefined error when initializing the line :
CvRTrees rtrees;
I think i have added all the necessary header files. So why am i getting this error?
#include <stdio.h>
#include<conio.h>
#include <opencv/cv.h>
#include <opencv2/highgui/highgui.hpp>
#include <opencv/cvaux.h>
#include <opencv/ml.h>
#include <opencv2/core/core.hpp>
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <math.h>
#include <windows.h>
#include <string>
#include <stdlib.h>
#include <exception>
#include <array>
#include "opencv2/ml/ml.hpp"
using namespace std;
using namespace cv;
This class exists in OpenCV 2.4.x, However it is not available in newer versions of OpenCV like 3.2.0. Check here the list of all cv::ml classes for OpenCV 3.2.0. I suggest you to use RTrees instead. To do this you do not need to include all headers, just include the machine learning module:
#include "opencv2/ml/ml.hpp"
I am having an error while trying to convert a string vector to a double vector. The error keeps saying:
error: 'stod' was not declared in this scope
Even though I enabled C++11 for my compiler and I used #include <string> I also used using namespace std; And it still didn't work.
The code is is down below:
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <sstream>
using namespace std;
using stod;
transform(userNums.begin(), userNums.end(), back_inserter(convUserNums), [](const string & astr){ return stod( astr) ; } ) ;
stod is defined in the namespace std. You should call it like std::stod.
Or put using namespace std; above.
Be sure to include the necessary header and using directive.
#include <string>
using std::stod;
int main( const int, const char** )
{
stod( "3.4" );
return EXIT_SUCCESS;
}
Please find the std::stod documentation here. Note that this function will throw both std::invalid_argument and std::out_of_range exceptions. A try-catch block is highly recommended.
The example was built with g++ -o main main.cpp -std=c++11 under gcc version 4.9.2 (Debian 4.9.2-10).
I tried to follow the instructions on
http://msdn.microsoft.com/en-us//library/vstudio/dd728073.aspx
I am using VS2010.
I added the following lines to my CPP file:
#include <windows.h>
#include <ppl.h>
#include <iostream>
#include <random>
using namespace concurrency;
But then the compiler tells me "Error C2871: 'concurrency': No namespace with that name exists.'"
Does anybody see what I did wrong?
Thank you!
Great, in VS2010 it has to be
using namespace Concurrency;
instead.
Trying to sort an array of Integers and after some googling, came across the solution using std::sort accompanied by this error: namespace "std" has no member "sort".
Just to disqalify any qualms that I'm not using the std namespace, here is my header:
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
using namespace std;
Add:
#include <algorithm>
as stated in the std::sort() reference page.
See Using std Namespace, Why is "using namespace std" considered bad practice? and many other questions on SO discussing using namespace std;.
Im trying to use NormalBayesClassifier in my code to apply bag of words. The pre-training matrix is ready and given to the trainme matrix. I am using it as follows:
NormalBayesClassifier classifier;
classifier.train(trainme, labels);
And I am getting the following error:
error C2065: 'NormalBayesClassifier' : undeclared identifier
I have added all the correct libraries and all other opencv functions work, including the features2d functions.
Here are my libraries:
#include <stdafx.h>
#include <stdlib.h>
#include <cv.hpp>
#include <cxcore.hpp>
#include <highgui.h>
#include <iostream>
#include "opencv2/nonfree/features2d.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include <fstream>
#include <windows.h>
using namespace cv;
using namespace std;
That should cover the NormalBayesClassifier function, then why am I getting this error?
According to the documentation, the class for the Normal Bayes Classifier is actually called CvNormalBayesClassifier.
The corresponding header file is:
#include "opencv2/ml/ml.hpp"