PDA

View Full Version : error C2514 error C2039



devilishruby
جمعه 25 بهمن 1387, 12:45 عصر
please help me to solve this problem, i really crack my head to solve it!
.
.
.

std::auto_ptr<std::ifstream> *keypointsIn_pt ;
keypointsIn_pt = std::auto_ptr<std::ifstream>(new std::ifstream(keypointsFilename.c_str(),std::ios:: binary)) ;
while( !keypointsIn_pt->eof() ) {....}
.
.


c:\ltilib\win\lti_sift04\sift.cpp(354) : error C2514: 'std::basic_ifstream<char,struct std::char_traits<char> >' : class has no constructors
c:\ltilib\win\lti_sift04\sift.cpp(356) : error C2039: 'eof' : is not a member of 'auto_ptr<class std::basic_ifstream<char,struct std::char_traits<char> > >'

SamaPic
جمعه 25 بهمن 1387, 13:07 عصر
با سلام خدمت دوست عزيز.
فكر كنم اين خطا ها مربوط به نگذاشتن مورد زير است كه بايد بعد از سرفايل ها گذاشته شوند.بررسي كنيد تا ببينيد آيا مشكل همين است يا نه.



using namespace std;


اميد وارم درست گفته باشم.
لطفا متن پيام را به زبان فارسي بنويسيد.
خدانگهدار.

devilishruby
جمعه 25 بهمن 1387, 13:13 عصر
با سلام خدمت دوست عزيز.
فكر كنم اين خطا ها مربوط به نگذاشتن مورد زير است كه بايد بعد از سرفايل ها گذاشته شوند.بررسي كنيد تا ببينيد آيا مشكل همين است يا نه.



using namespace std;


اميد وارم درست گفته باشم.
لطفا متن پيام را به زبان فارسي بنويسيد.
خدانگهدار.


سلام نه این را قبلا امتحان کرده ام مشکل حل نشد

SamaPic
جمعه 25 بهمن 1387, 13:13 عصر
با سلام مجدد.
كد رو بگذار تا بشود بهتر كمك كرد.
خدانگهدار.

devilishruby
جمعه 25 بهمن 1387, 14:51 عصر
کدی که دارم خیلی زیاده چون از چند پروژه استفاده می کنه! اما فایلم اینطوریه



#include<vector>
#include<math.h>
#include"sift.hpp"
#include"sift.h"
#include"sift.ipp"
#include"sift-conv.h"
#include<algorithm>
#include<iostream>
#include<memory>
#include<sstream>
#include<cassert>
.
.
.
Sift::Keypoint* Sift::ReadKeys(FILE *fp)
{
Keypoints keypoints ;
std::string keypointsFilename;
// If a keypoint file is provided, then open it now
std::auto_ptr<std::ifstream> *keypointsIn_pt ;
keypointsIn_pt = std::auto_ptr<std::ifstream>
(new std::ifstream(keypointsFilename.c_str(),std::ios:: binary)) ;

while( !keypointsIn_pt->eof() ) {
VL::float_t x,y,sigma,th ;

// read x, y, sigma and th from the beginning of the line
(*keypointsIn_pt)
>> x
>> y
>> sigma
>> th ;

// skip the rest of the line
(*keypointsIn_pt).ignore(numeric_limits<streamsize>::max(),'\n') ;

// break the loop if end of file reached
if( keypointsIn_pt->eof() ) break ;

//trhow an error if something wrong
if( ! keypointsIn_pt->good() )
VL_THROW("Error reading keypoints file.") ;

// compute integer components
VL::Sift::Keypoint key
= sift.getKeypoint(x,y,sigma) ;

Keypoints::value_type entry ;
entry.first = key ;
entry.second = th ;
keypoints.push_back(entry) ;
}
}