Re: Function not definen in current scope

From: Cedric Sodhi <manday_at_gmx.net>
Date: Sun, 21 Mar 2010 19:24:03 +0100


The weird part about it is that it even tab completes deCASS... and lists the correct signatures, but doesn't find it nevertheless. I'm clueless.

On 21.03.2010 17:30, Cedric Sodhi wrote:
> I'm unfortuanlly not getting anywhere even after I've simplified the
> code as Axel suggested. It now reads:
>
> #include <deque>
> #include <sstream>
> #include <fstream>
> #include <algorithm>
>
> void test( ) { std::cout << "LOADED cassy.h" << std::endl; }
>
> std::deque< float >* deCASSYfy( const char*,const char* const&,const
> unsigned int );
> std::deque< float >* deCASSYfy( std::ifstream&,const char* const&,const
> unsigned int );
>
> std::deque< float >* deCASSYfy( const char *inFile,const char* const&
> cols,const unsigned int colcnt ) {
> std::ifstream dataFile( inFile );
> return deCASSYfy( dataFile,cols,colcnt );
> }
>
> std::deque< float >* deCASSYfy( std::ifstream& inFile,const char* const&
> cols,const unsigned int colcnt ) {
> if( !inFile.good( ) )
> throw "Filestram could not be read";
> std::cout << sizeof( cols );
> std::deque< float > *dataSet = new std::deque< float >( );
> std::string lastLine;
> float lastVal = 0;
> while( std::getline( inFile,lastLine ) ) {
> unsigned int fieldPos = 0;
> unsigned int j = 0;
> if( lastLine.find( "\t" )!= std::string::npos ) {
> for( unsigned int i = 0; j < colcnt; i++ )
> if( fieldPos != std::string::npos ) {
> std::istringstream lastField( lastLine.substr( fieldPos ) );
> fieldPos = lastLine.find( "\t",fieldPos + 1 );
> if( std::find( cols,cols + colcnt,i )!=( cols + colcnt ) ) {
> lastField >> std::scientific >> lastVal;
> dataSet->push_back( lastVal );
> j++;
> }
> } else {
> dataSet->push_back( 0.0 );
> j++;
> }
> }
> }
> return dataSet;
> }
>
> -----
> Yet, I get
>
> root [0] #include "E:\mydocs\Programs\Akustik\cassy.h";
> root [1] test( );
> LOADED cassy.h
> root [2] const int cols[ ]={ 1,2 };
> root [3] deque< float >* myData = deCASSYfy(
> "E:\\mydocs\\cassy.lab",cols,2 );
> Error: Function deCASSYfy("E:\\mydocs\\cassy.lab",cols,2) is not defined
> in curr
> ent scope (tmpfile)(1)
> *** Interpreter error recovered ***
> root [4]
>
Received on Sun Mar 21 2010 - 19:24:15 CET

This archive was generated by hypermail 2.2.0 : Sun Mar 21 2010 - 23:50:02 CET