LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-09-2011, 10:27 PM   #1
fsshl
Member
 
Registered: Jan 2002
Distribution: Ubuntu10.04
Posts: 49

Rep: Reputation: 1
compile error on std::string(ptr.get())


Dear Linux c/g++ programers:

when I tried to test/compile a piece msvc++ workable code on my g++4.5.2 on
linux 2.6.38-10

I got compile errors

root@eric-laptop:/home/eric/cppcookbook/ch14# g++ Example14-8.cpp
In file included from Example14-8.cpp:9:0:
xerces_strings.hpp: In function ‘std::string toNative(const XMLCh*)’:
xerces_strings.hpp:26:34: error: expected initializer before ‘<’ token
xerces_strings.hpp:27:24: error: ‘ptr’ was not declared in this scope
-------------------------------
my xerces_strings.hpp
------------26, 27----------
Code:
    boost::scoped_array<char> ptr<xercesc::XMLString::transcode(str));
    return std::string(ptr.get());
I have a similar code with ptr, but my g++ did not complain error which is
used in XercesString(ptr.get());

looking to see experts' help and thanks a lot in advance, Eric
 
Old 08-10-2011, 07:52 AM   #2
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
There's an obvious syntax error in the first line. You need to look at what the errors say, not just at the line numbers.
Kevin Barry
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Template algorithm for std::vector and std::string CartmanYO Programming 4 09-08-2010 09:56 AM
Compiler error: "Conversion from 'bool' to non-scalar type 'std::string' requested" Kenny_Strawn Programming 6 03-06-2010 08:22 PM
Assigning custom string to std::string in C++ jh7777 Programming 4 10-13-2009 12:02 AM
compile error: undefined reference to std::basic_ostream ron7000 Programming 5 09-17-2008 09:13 AM
SIGSEGV for std::string dragondad Programming 2 02-05-2006 11:26 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration