error: argument dependent lookup finds ‘foo::bar’

This is a wiki page. Be bold and improve it!

If you have any questions about the content on this page, don't hesitate to open a new ticket and we'll do our best to assist you.


g++ main.cpp -o run
/usr/include/c++/4.4/iosfwd: In function ‘int main()’:
/usr/include/c++/4.4/iosfwd:135: error: argument dependent lookup finds ‘std::stringstream’
main.cpp:41: error:   in call to ‘stringstream’
make: *** [run] Error 1

The line that prompted this error:

stringstream(mystring) >> yours.year;

The problem was twofold.

1- the std namespace was not specified:

std::stringstream(mystring) >> yours.year;

2- the proper header file was not included:

#include <sstream>