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 5 Years Ago by Narue: added code tags

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?

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?

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

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

This article has been dead for over six months. Start a new discussion instead.