I tried to install install one program at Ubuntu and it uses main.cpp .I dont know why but it gives always error.(main.cpp syntax correct 100%) and this program works without error @Mac system but not ubuntu.I couldnt know to how to fix it.Please can you help that issue?

g++ version : g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

Error below:

g++ -O2 -g -Wall -fmessage-length=0 -I/usr/include/mysql    -c -o main.o main.cpp
In file included from /usr/include/c++/4.6/sstream:580:0,
                 from /usr/local/include/glog/logging.h:44,
                 from main.cpp:13:
/usr/include/c++/4.6/bits/sstream.tcc: In member function ‘virtual std::basic_stringbuf<_CharT, _Traits, _Alloc>::int_type std::basic_stringbuf<_CharT, _Traits, _Alloc>::overflow(std::basic_stringbuf<_CharT, _Traits, _Alloc>::int_type)’:
/usr/include/c++/4.6/bits/sstream.tcc:112:39: error: expected unqualified-id before ‘(’ token
/usr/include/c++/4.6/bits/sstream.tcc:114:35: error: expected unqualified-id before ‘(’ token
make: *** [main.o] Error 1
  • Please post the relevant lines from sstream.h, main.cpp, etc – poolie Jun 17 '13 at 8:20

A Google search for that error message suggests this is caused by a macro max interfering with code in sstream.h. Try adding these lines just above where it is included in main.cpp:

#undef max
#undef min

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.