By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,190 Members | 2,204 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,190 IT Pros & Developers. It's quick & easy.

Any tips on finding the problematic line of code?

P: n/a
Hello, when I compile my project I get this (after doing a complete
clean first):
$ make
g++ -Wall -W -ansi -pedantic -g3 -O0 -D_WIN32_WINNT=0x501
-D_WIN32_IE=0x600 -c common_dialogs.cpp
g++ -Wall -W -ansi -pedantic -g3 -O0 -D_WIN32_WINNT=0x501
-D_WIN32_IE=0x600 -c crc32.cpp
g++ -Wall -W -ansi -pedantic -g3 -O0 -D_WIN32_WINNT=0x501
-D_WIN32_IE=0x600 -c globals.cpp
g++ -Wall -W -ansi -pedantic -g3 -O0 -D_WIN32_WINNT=0x501
-D_WIN32_IE=0x600 -c main_window_procedure.cpp
g++ -Wall -W -ansi -pedantic -g3 -O0 -D_WIN32_WINNT=0x501
-D_WIN32_IE=0x600 -c sfv_list_view.cpp
In file included from
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/sstream:640,
from sfv_list_view.cpp:8:
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/sstream.tcc: In
member function `virtual typename std::basic_stringbuf<_CharT, _Traits,
_Alloc>::int_type std::basic_stringbuf<_CharT, _Traits,
_Alloc>::overflow(typename _Traits::int_type)':
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/sstream.tcc:102:
error: expected unqualified-id before '(' token
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/sstream.tcc:104:
error: expected unqualified-id before '(' token
sfv_list_view.cpp: At global scope:
sfv_list_view.cpp:184: warning: unused parameter 'arg'
make: *** [sfv_list_view.o] Error 1

It seems to be a problem involving how stringstreams are used in
sfv_list_view.cpp but all error messages point to the implementation
files of the standard library. Any tips on finding the offending line
of code that triggers all these obscure error messages deep inside
libstdc++ other than commenting things out (which may or may not be
easy to do)?

/ E

Jul 1 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a

Eric Lilja wrote:
Hello, when I compile my project I get this (after doing a complete
clean first):
$ make
g++ -Wall -W -ansi -pedantic -g3 -O0 -D_WIN32_WINNT=0x501
-D_WIN32_IE=0x600 -c common_dialogs.cpp
g++ -Wall -W -ansi -pedantic -g3 -O0 -D_WIN32_WINNT=0x501
-D_WIN32_IE=0x600 -c crc32.cpp
g++ -Wall -W -ansi -pedantic -g3 -O0 -D_WIN32_WINNT=0x501
-D_WIN32_IE=0x600 -c globals.cpp
g++ -Wall -W -ansi -pedantic -g3 -O0 -D_WIN32_WINNT=0x501
-D_WIN32_IE=0x600 -c main_window_procedure.cpp
g++ -Wall -W -ansi -pedantic -g3 -O0 -D_WIN32_WINNT=0x501
-D_WIN32_IE=0x600 -c sfv_list_view.cpp
In file included from
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/sstream:640,
from sfv_list_view.cpp:8:
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/sstream.tcc: In
member function `virtual typename std::basic_stringbuf<_CharT, _Traits,
_Alloc>::int_type std::basic_stringbuf<_CharT, _Traits,
_Alloc>::overflow(typename _Traits::int_type)':
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/sstream.tcc:102:
error: expected unqualified-id before '(' token
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/sstream.tcc:104:
error: expected unqualified-id before '(' token
sfv_list_view.cpp: At global scope:
sfv_list_view.cpp:184: warning: unused parameter 'arg'
make: *** [sfv_list_view.o] Error 1

It seems to be a problem involving how stringstreams are used in
sfv_list_view.cpp but all error messages point to the implementation
files of the standard library. Any tips on finding the offending line
of code that triggers all these obscure error messages deep inside
libstdc++ other than commenting things out (which may or may not be
easy to do)?

/ E


Ok, this particular problem was caused by include order...

Jul 1 '06 #2

P: n/a
Eric Lilja wrote:
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/sstream.tcc:102:
error: expected unqualified-id before '(' token


Next time, look that line up and paste it into this post.

The line contains std::max(

Some systems also define max as a macro.

Go to sfv_list_view.cpp:7:, above the #include <sstream>, and add this:

#undef max

That's just a guess, so report back if it doesn't work.

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Jul 1 '06 #3

P: n/a

Phlip wrote:
Eric Lilja wrote:
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/sstream.tcc:102:
error: expected unqualified-id before '(' token

Next time, look that line up and paste it into this post.

The line contains std::max(

Some systems also define max as a macro.

Go to sfv_list_view.cpp:7:, above the #include <sstream>, and add this:

#undef max

That's just a guess, so report back if it doesn't work.
FWIW the *acceptable* way to deal with this situation (courtesy of the
gurus at http://www.boost.org) is as follows:

// crappy hackers macro
#define min(a,b) (((a) < (b)) ? (a) : (b))

struct my{
typedef int min;
};

int main()
{
//###################################
// int n = my::min(); // Error
//###################################
#define PREVENT_MACRO_SUBSTITUTION
int n = my::min PREVENT_MACRO_SUBSTITUTION (); // OK
}

The boost version in <boost/config.hppis called
BOOST_PREVENT_MACRO_SUBSTITUTION and is worth using so the gurus
understand what you mean when they read your code.

regards
Andy Little

Jul 1 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.