What's wrong with this C++ program? -
i have header file , and .cpp file passing value function gives me error
main.c
#include "me.h" #include <iostream> #include <sstream> #include <string.h> using namespace std; int main() { me("http"); }
me.h
#ifndef me_h_ #define me_h_ #include <string.h> class me { public: me(std::string u); virtual ~me(); }; #endif /* me_h_ */
me.cpp
#include "me.h" #include <iostream> #include <string.h> using namespace std; me::me(std::string u) { // todo auto-generated constructor stub cout << "help"; } me::~me() { // todo auto-generated destructor stub }
i getting error
in file included ../src/me.cpp:8: ../src/me.h:13: error: expected ‘)’ before ‘u’ ../src/me.cpp:12: error: prototype ‘me::me(std::string)’ not match in class ‘me’ ../src/me.h:11: error: candidates are: me::me(const me&) ../src/me.h:11: error: me::me() make: *** [src/me.o] error 1
#include <string>
instead of #include <string.h>
string.h c string header, accessible in c++ <cstring>
<string>
c++ header defines std::string
Comments
Post a Comment