#ifndef MYDLL_H
#define MYDLL_H
#endif // MYDLL_H
#ifdef MYDLL_EPORTS
#define MYDLL_API __declspec(dllexport)
#else
#define MYDLL_API __declspec(dllimport)
#endif // MYDLL_EPORTS
MYDLL_API long Fact_none_recursive(int n);
MYDLL_API long Fact_recursive(int n);
MYDLL_API int arlength(string F);
`I'm trying to create a dll and this is my header file(mydll.h) and when I attempt to build or compile the source or impletation file I receive below errors:
14...error:definition of 'int arlength' is marked 'dllimport'
14...error:'string' was not declared in this scope
and this is the impletation of this function in source file (mydll.cpp): `
MYDLL_API int arlength(string F){ `error:expected','or';'before '{'token
error:'string' was not declared in this scope
error:definition of 'int arlength'is marked'dllimport'`
string line;
int count=0;
ifstream inFile (F);
if(inFile.is_open())
{
while(inFile.peek()=!EOF)
{
getline(inFile,line);
count++;
}
}
inFile.close();
else
cout<<"couldn't open the file.";
return count;
}
Are these errors because macros in header file? if not,what causes this error?
I'm trying to make a dll with c++.I declared macros like code samples and dll prototypes I saw and I got some unexpected errors.