C++ Regarding .h and .cpp - Multiple definition of
<p>I face a error of "multiple definition of "
I got 3 files, namely currency.h, currency.cpp,main.cpp</p>

<p>At currencyConverter.h under currencyConverter class 
I did</p>

<pre><code>using namespace std;

class currencyConverter
{

string result;
stringstream ss;
size_t found,found2;

public:
   void getInbetween(string,string);

};

#endif  /* CURRENCYCONVERTER_H */
</code></pre>

<p>Then at currencyConverter.cpp I did</p>

<pre><code>#include "currencyConverter.h"
void currencyConverter::getInbetween(string selection,string str2,string str3,string sdata)
{

buffer[result.length()] = '\0';     //insert '\0'

char * pch;
 pch = strtok (buffer," ");

}

void currencyConverter::webparser(const string siteurl,const string filename)
{
    ss &lt;&lt; "lynx -dump '" &lt;&lt; siteurl &lt;&lt; "' &gt; " &lt;&lt; filename;
}

string currencyConverter::userOption()
{
    //some code    
    return selection;
}
</code></pre>

<p>at main2.cpp</p>

<pre><code>#include&lt;iostream&gt;


#include"currencyConverter.cpp"

using namespace std;

int main() {

    currencyConverter c;
    string exitstr;


    if(selection!="6")
    {

    c.webparser(parsePage,"file.txt");    
    //now perform searchstring
    c.searchString(selection,"file.txt");
    }


    }while (1);

return 0;
}
</code></pre>

<p>This is my make file</p>

<pre><code># ExampleTests Project

SRCS = main2.cpp

HDRS = 

PROJ = main

CC = g++

OBJS = $(SRCS:.cpp=.o)

APP = $(PROJ).exe

CFLAGS = -c -g -Wall -I/opt/local/include

ifeq (,$(findstring CYGWIN,$(shell uname)))

LIBS = -lcppunit -ldl



all: $(APP)



$(APP): $(OBJS)

    $(CC) $(LDFLAGS) $(OBJS) -o $(APP) $(LIBS)




clean:

    rm -f *.o $(APP)
</code></pre>

<p>But i receive this error on compiler</p>

<p>How to get this fix.. I did not use it twice. I pasted part of my currencyConverter.cpp with the function webparser, is there a error in the way i call my function at main2.cpp ?</p>

<pre><code>rm -f *.o main.exe

CLEAN SUCCESSFUL (total time: 86ms)
g++    -c -o main2.o main2.cpp
</code></pre>

<p>td::char_traits, std::allocator >)':
    currencyConverter.cpp:(.text+0xcec): multiple definition of `currencyConverter::webparser(std::basic_string, std::allocator >, std::basic_string, std::allocator >)'
    main2.o:main2.cpp:(.text+0xcec): first defined here
    collect2: ld returned 1 exit status
    make: <em>*</em> [main.exe] Error 1</p>
