473,387 Members | 1,673 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

no matching function for call to `std::basic_string<char, std::char_traits<char>, std

1
I am working on a c++ project using DEV C++.Following is the implementation file of a header CrStr.h


Expand|Select|Wrap|Line Numbers
  1. #include "CrStr.h"
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6.  
  7.  
  8. int Crlen(CrString str)
  9.     return strlen(str);
  10. }
  11.  
  12. string PrePadder(const char*,int spaces)
  13. {
  14.     //      
  15. }
  16.  
  17. string CrPreCat(const string PreStr,string PostStr)
  18. {
  19.  
  20.       const string prStr = PreStr;
  21.       PostStr.insert(pstStr.begin(),prStr); //  I am getting the error in this line.
  22.  
  23.       return PostStr;
  24.  
  25. }
  26.  
  27. string CrConCat(char* PreStr,CrString PostStr)
  28. {
  29.          //char*(PreStr);
  30.          return strcat(PreStr,PostStr);
  31. }
I can't figure out the root cause of this issue.It will be greatly helpful if someone show me the way out of here.

Thanks in advance
Feb 20 '13 #1
2 7708
weaknessforcats
9,208 Expert Mod 8TB
This code:
Expand|Select|Wrap|Line Numbers
  1. return strcat(PreStr,PostStr);
looks fishy because PosStr is a string object and strcat needs a char* argument.

Should it not be:

Expand|Select|Wrap|Line Numbers
  1. return strcat(PreStr,PostStr_ctr());
?
I am not understanding why the mixing of C stirng functions (strlen, strcat) with C++ string objects.

This code:
Expand|Select|Wrap|Line Numbers
  1. string CrPreCat(const string PreStr,string PostStr)
  2.   {
  3.  
  4.         const string prStr = PreStr;
  5.         PostStr.insert(pstStr.begin(),prStr); //  I am getting the error in this line.
  6.  
  7.         return PostStr;
  8.  
  9.   }
There is no string pstStr defined.
Feb 21 '13 #2
Banfa
9,065 Expert Mod 8TB
If you are going to post compiler output then post the complete compiler output please.
Feb 21 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: mangi03 | last post by:
Hi, I came acrosss g++ compile errors whenever I make a function call by reference and found out from the test program that compiler is treating the function argument differently when another...
1
by: A. Farber | last post by:
Hi, I'm trying to port a bigger program from Visual C++ to Linux and after rewriting few Visual C++ functions (strnicmp, filelength, findnext, etc.) I'm finally down to just one (!) error...
7
by: Vaca Louca | last post by:
Hello, My setup: Debian sarge on dual Pentium 4. g++ 3.3.5-3. (the other system is Windows XP with MS Visual Studio .NET 2003) I have an auto_array<T> template (based on a template taken from...
2
by: Lateralus | last post by:
headers/vector3.h: In member function ‘Vector3 Vector3::operator*(Scalar)’: headers/vector3.h:13: error: no matching function for call to ‘Vector3::Vector3(Vector3)’...
3
by: Jeff | last post by:
Its been years since I did C++ and Im unsure what this is about. I have a QT class Im inheriting from in my .h file: class Mosfet : Q3CanvasRectangle { public: Mosfet::Mosfet(const QRect...
16
by: Martin Jørgensen | last post by:
Hi, Short question: Any particular reason for why I'm getting a warning here: (cast from function call of type int to non-matching type double) xdouble = (double)rand()/(double)RAND_MAX;
1
by: yuanhp_china | last post by:
I define a class: class RtServer { public: RtServer(); void init(); void close();
2
by: hectic | last post by:
i have three file header file where i define the function prototype and the other implementaion file for the function body and other one is the test file which takes input for the implementation file...
2
by: cablepuff | last post by:
template <typename ContainerType> ContainerType rsa_encrypt_list(const std::string&, const typename ContainerType::reference, const typename ContainerType::reference); const BigInteger...
5
by: tomas | last post by:
Hi. I wrote a code similar to this one, for a wrapper application that I needed: #include <iostream> using namespace std; class Client {
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.