0

I have not found a solution yet, please help!
My header files are structs which house the declarations of my functions
and the associated CPP file houses the implementation.
I want to pass a string to my ADD and REMOVE but get compile errors..

///
//Profiles.H
///

#ifndef __PROFILES_H
#define __PROFILES_H
#include "string.h"

using namespace std;

struct Profiles
{
       int MyProfile();
       int AddTickerSymbol(string x);
       int RemoveTickerSymbol(string x);
       
};
#endif
///
//Profiles.cpp
///
#include "Profiles.h"
#include <iostream>
#include "curl.h"
#include <string>  

using namespace std;

int Profiles::MyProfile() 
{                  
     cout<<"Hello profiles"<<endl;
     return(0);
}
int Profiles::AddTickerSymbol(string Input_From_User) 
{                  
     cout<<"ADD"<<endl;
     return(0);
}
int Profiles::RemoveTickerSymbol(string Input_From_User) 
{                  
     cout<<"REMOVE"<<endl;
     return(0);
}

///
//ERRORS
///

file included from Profiles.cpp
expected `;' before '(' token
expected `;' before '(' token
no `int Profiles::AddTickerSymbol(std::string)' member function declared in class `Profiles'
no `int Profiles::RemoveTickerSymbol(std::string)' member function declared in class `Profiles'
[Build Error] [Profiles.o] Error 1

the errors are referring to lines in my .H File
int AddTickerSymbol(string x);
int RemoveTickerSymbol(string x);

What am I doing wrong?

Edited by Narue: added code tags

4
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by ztdep
0

What happens if you include <string> before you include Profiles.h? If that doesn't solve the problem, can you tell us which line(s) the compiler reports as erroneous?

0

That may have solved it! Thank you, let me play around with the code and i'll let you know... Would u reccomend i pass a pointer to the string?

1

I'd recommend lots of things, but not without seeing the whole program or what you're trying to do with it.

0

please past the curl.h, i just met this problem yesterday. and my problem is something like circular referencing.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.