Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Any tips on finding the problematic line of code?

Reply
Thread Tools

Any tips on finding the problematic line of code?

 
 
Eric Lilja
Guest
Posts: n/a
 
      07-01-2006
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>:verflow(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

 
Reply With Quote
 
 
 
 
Eric Lilja
Guest
Posts: n/a
 
      07-01-2006

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>:verflow(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...

 
Reply With Quote
 
 
 
 
Phlip
Guest
Posts: n/a
 
      07-01-2006
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!!!


 
Reply With Quote
 
kwikius
Guest
Posts: n/a
 
      07-01-2006

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.hpp> is called
BOOST_PREVENT_MACRO_SUBSTITUTION and is worth using so the gurus
understand what you mean when they read your code.

regards
Andy Little

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
501 PIX "deny any any" "allow any any" Any Anybody? Networking Student Cisco 4 11-16-2006 10:40 PM
HELP? Composer Problematic Mozilla/Nvu/Netscape glob Firefox 1 12-29-2004 05:51 PM
placeholder proves problematic postback Fraggle ASP .Net 1 11-27-2003 12:13 PM
Problematic Postbacks Duray AKAR ASP .Net 0 08-12-2003 07:08 PM
Re: Problematic Postbacks Lim Siew Cheng ASP .Net 3 08-12-2003 06:23 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57