please help : Error: Unexpected type name

HI all, when I try to compile the example code only use boost head-file in SunOS :
#include <boost/lambda/lambda.hpp> #include <iostream> #include <iterator> #include <algorithm>
int main() { using namespace boost::lambda; typedef std::istream_iterator<int> in;
std::for_each( in(std::cin), in(), std::cout << (_1 * 3) << " " ); }
I get many errors like 'Unexpected type name', the first one is :
CC -g -I../. -c -o main.o main.C ".././boost/lambda/detail/function_adaptors.hpp", line 203: Error: Unexpected type name "boost::lambda::Arg1" encountered.
could someone give a hand.
sun

hi Steven, version : CC: Forte Developer 7 C++ 5.4 Patch 111715-18 2006/11/02 CClink: Forte Developer 7 C++ 5.4 Patch 111715-18 2006/11/02 CC: Forte Developer 7 C++ 5.4 Patch 111715-18 2006/11/02 Forte Developer 7 C++ 5.4 2002/03/09 Thanks, sun -----Original Message----- From: boost-users-bounces@lists.boost.org To: boost-users@lists.boost.org Subject: Re: [Boost-users] please help : Error: Unexpected type name AMDG Sun, Xiuxin wrot
when I try to compile the example code only use boost head-file in SunOS :
What compiler version? In Christ, Steven Watanabe _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Sun, Xiuxin wrote:
HI all, when I try to compile the example code only use boost head-file in SunOS :
#include <boost/lambda/lambda.hpp> #include <iostream> #include <iterator> #include <algorithm>
int main() { using namespace boost::lambda; typedef std::istream_iterator<int> in;
std::for_each( in(std::cin), in(), std::cout << (_1 * 3) << " " ); }
Try this: typedef std::istream_iterator<int> in; std::for_each( in(std::cin), in(), std::cout << boost::lambda::_1*3 << " " ); HTH, Bruce
I get many errors like 'Unexpected type name', the first one is :
CC -g -I../. -c -o main.o main.C ".././boost/lambda/detail/function_adaptors.hpp", line 203: Error: Unexpected type name "boost::lambda::Arg1" encountered.
could someone give a hand.
sun
------------------------------------------------------------------------
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

HI Bruce , it's already in the code .
using namespace boost::lambda; typedef std::istream_iterator<int> in;
std::for_each( in(std::cin), in(), std::cout << (_1 * 3) << " " ); }
-----Original Message----- From: boost-users-bounces@lists.boost.org
HI all, when I try to compile the example code only use boost head-file in
SunOS :
#include <boost/lambda/lambda.hpp> #include <iostream> #include <iterator> #include <algorithm>
int main() { using namespace boost::lambda; typedef std::istream_iterator<int> in;
std::for_each( in(std::cin), in(), std::cout << (_1 * 3) << " " ); }
Try this: typedef std::istream_iterator<int> in; std::for_each( in(std::cin), in(), std::cout << boost::lambda::_1*3 << " " ); HTH, Bruce

it's already in the code .
Understood. I am advocating that you fully qualify the _1 at the call site as you might be running afoul of a clash with some other _1s. Sun, Xiuxin wrote:
HI Bruce , it's already in the code .
using namespace boost::lambda; typedef std::istream_iterator<int> in;
std::for_each( in(std::cin), in(), std::cout << (_1 * 3) << " " ); }
-----Original Message----- From: boost-users-bounces@lists.boost.org
HI all, when I try to compile the example code only use boost head-file in SunOS : #include <boost/lambda/lambda.hpp> #include <iostream> #include <iterator> #include <algorithm>
int main() { using namespace boost::lambda; typedef std::istream_iterator<int> in;
std::for_each( in(std::cin), in(), std::cout << (_1 * 3) << " " ); }
Try this: typedef std::istream_iterator<int> in;
std::for_each( in(std::cin), in(), std::cout << boost::lambda::_1*3 << " " ); HTH, Bruce

Still get same errors even after comment out following lines that the possibility of _1 error could be excluded. ------------- #include <boost/lambda/lambda.hpp> #include <iostream> #include <iterator> #include <algorithm> int main() { using namespace boost::lambda; // typedef std::istream_iterator<int> in; // std::for_each( // in(std::cin), in(), std::cout << (_1 * 3) << " " ); } --------------- thanks, sun -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Bruce Trask Sent: Wednesday, July 23, 2008 1:33 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] please help : Error: Unexpected type name
it's already in the code .
Understood. I am advocating that you fully qualify the _1 at the call site as you might be running afoul of a clash with some other _1s. Sun, Xiuxin wrote:
HI Bruce , it's already in the code .
using namespace boost::lambda; typedef std::istream_iterator<int> in;
std::for_each( in(std::cin), in(), std::cout << (_1 * 3) << " " ); }

On Wed, Jul 23, 2008 at 7:14 AM, Sun, Xiuxin <xiuxin.sun@citi.com> wrote:
Still get same errors even after comment out following lines that the possibility of _1 error could be excluded.
------------- #include <boost/lambda/lambda.hpp> #include <iostream> #include <iterator> #include <algorithm>
int main() { using namespace boost::lambda; // typedef std::istream_iterator<int> in;
// std::for_each( // in(std::cin), in(), std::cout << (_1 * 3) << " " ); } --------------- thanks, sun
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Bruce Trask Sent: Wednesday, July 23, 2008 1:33 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] please help : Error: Unexpected type name
it's already in the code .
Understood. I am advocating that you fully qualify the _1 at the call site as you might be running afoul of a clash with some other _1s.
Sun, Xiuxin wrote:
HI Bruce , it's already in the code .
using namespace boost::lambda; typedef std::istream_iterator<int> in;
std::for_each( in(std::cin), in(), std::cout << (_1 * 3) << " " ); }
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Can I just be absolutely clear here - Do you mean that compiling this code:- #include <boost/lambda/lambda.hpp> #include <iostream> #include <iterator> #include <algorithm> int main() { using namespace boost::lambda; } Gives you compile errors? Rob.

yes, the file relation of my test code is : main.C is placed in .../boost_1_35_0/test/ boost is in .../boost_1_35_0/ CC version : Forte Developer 7 C++ 5.4 Patch 111715-18 2006/11/02 and errors are : CC -g -I../. -c -o main.o main.C ".././boost/lambda/detail/function_adaptors.hpp", line 203: Error: Unexpected type name "boost::lambda::Arg1" encountered. ".././boost/lambda/detail/function_adaptors.hpp", line 203: Error: Cannot cast from int to boost::lambda::Result. ".././boost/lambda/detail/function_adaptors.hpp", line 210: Error: Template parameter boost::lambda::Func requires a type argument. ".././boost/lambda/detail/function_adaptors.hpp", line 202: Error: The type of specialized argument boost::lambda::Func is dependent on another argument. ".././boost/lambda/detail/function_adaptors.hpp", line 202: Error: Partial specialization parameter Arg1 is not used in the arguments. ".././boost/lambda/detail/function_adaptors.hpp", line 202: Error: Partial specialization parameter Result is not used in the arguments. ..................................... thanks. ------------------------------------------------------------------------ -------------------------------------- Can I just be absolutely clear here - Do you mean that compiling this code:- #include <boost/lambda/lambda.hpp> #include <iostream> #include <iterator> #include <algorithm> int main() { using namespace boost::lambda; } Gives you compile errors? Rob.

On Wed, Jul 23, 2008 at 06:05:35PM +0800, Sun, Xiuxin wrote:
and errors are : CC -g -I../. -c -o main.o main.C
You mentioned in your earlier post that you were using Sun Forte 7 compiler. AFAIK, that is ancient; boost 1.34 needs at least Sun Studio 11, and boost 1.35 does not support Sun's C++ compiler at all :(
participants (5)
-
Bruce Trask
-
Robert Jones
-
Steven Watanabe
-
Sun, Xiuxin
-
Zeljko Vrba