Originally posted by: bernardn
I am getting this linker error with ifstream::tellg and ofstream::tellp:
ld: 0711-407 ERROR: Symbol std::fpos<char*>::_Stz
Visibility is not allowed on a reference to an imported symbol.
This occurs when compiling with -O and -qvisibility=hidden with xlC_r 16.1 and 13.1 on AIX 7.2 (ppc and ppc64). For example:
$ cat test.cpp
#include <fstream>
int main()
{
std::ifstream is("foo.txt");
std::streampos p = is.tellg();
return 0;
}
$ xlC_r -qvisibility=hidden -O test.cpp
ld: 0711-407 ERROR: Symbol std::fpos<char*>::_Stz
Visibility is not allowed on a reference to an imported symbol.
A work-around is to expand tellg to what it actually does, is.rdbuf()->pubseekoff(0, is.cur, is.in), but that's not convenient.
Any insight on what's happening? It works fine without -O, and calls to other ifstream/ofstream functions don't appear to be affected.
Thanks,
Bernard
#Ask-Question-Here--General-Compiler-Q-and-A#C/C++andFortran