• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
link problem on inline function basic_istream::seekg
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

link problem on inline function basic_istream::seekg


  • Subject: link problem on inline function basic_istream::seekg
  • From: Victor Liu <email@hidden>
  • Date: Mon, 12 Apr 2004 13:28:40 +0800

Hi,


in my program that include <fstream> and use std::iftream in below piece of code
It need compatible with 10.2 so I use 10.2.7 sdk and target set with OS version 10.2.
it got a error at link stage :


ld: Undefined symbols:
std::basic_istream<char, std::char_traints<char> >::seekg(std::fpos<__mbstate_t>)


I trace the <fstream> and find the seekg is be implement as below and define at istream.tcc :

template<typename _CharT, typename _Traits>
    basic_istream<_CharT, _Traits>&
    basic_istream<_CharT, _Traits>::
    seekg(pos_type __pos) .....

I think that is a inline function, why this inline function not merge in to my program's module and need a external function reference ?

please let me know if you have any idea regarding this problem.

ps. this problem did not happen at when I build it by use 10.3 sdk and target

thanks.

---
void LogFile::ReadNext(long key, std::string& result)
{
	std::ostringstream os;

	//regular the value of key
	if( key < m_lPersistKey )
		key = m_lPersistKey;

	AutoMutex lock(m_mutex);

	std::ifstream is( m_strFilename.c_str() );
	if( ! is ) {
		os << key;
		result = os.str();
		return;
	}

	is.seekg(0, std::ios::end);
	long maxsize = is.tellg();
	long begin = (key - m_lPersistKey)*(m_nLineUnit+1);

	if( maxsize < begin ) {

		key = maxsize / (m_nLineUnit+1);
		os << key;
		result = os.str();
		return;
	}


long rdsize = maxsize - begin; if( rdsize > m_nMaxGetting*(m_nLineUnit+1)) rdsize = m_nMaxGetting*(m_nLineUnit+1);

	long rdline = rdsize/(m_nLineUnit+1);

	os << key + rdline;

	if( rdline )
		os << ' ';


/*

	problem on here, it can pass compile but build can not

	*/

	is.seekg( begin );

	std::istreambuf_iterator<char> ix( is );
	std::ostreambuf_iterator<char> ox( os );

	for( int i = 0; i < rdline; ++i) {

		// copy a line
		for( int j = 0; j < m_nLineUnit; ++j, ++ix, ++ox )
			*ox = *ix;
	}

	result = os.str();

}


Victor Liu. _______________________________________________ xcode-users mailing list | email@hidden Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users Do not post admin requests to the list. They will be ignored.


  • Prev by Date: text editor window width
  • Next by Date: Re: resolution to "-lcrt1.o" missing problem?
  • Previous by thread: text editor window width
  • Next by thread: Re: link problem on inline function basic_istream::seekg
  • Index(es):
    • Date
    • Thread