c++ - Errors compiling a DLL in Visual studio -


i have create dll function in c++. created project choosing dll , used default sample example created automatically in beginning.

i edited 2 files :

ocr2.h

using namespace std;   #ifdef ocr2_exports #define ocr2_api __declspec(dllexport) #else #define ocr2_api __declspec(dllimport) #endif  // cette classe est exportée de ocr2.dll class ocr2_api cocr2 { public:     cocr2(void);     // todo: ajoutez ici vos méthodes. };  extern ocr2_api int nocr2;  ocr2_api int fnocr2(void); ocr2_api bool comparer(bool latin, string lieninitial, string lienstr1, string lienstr2, string lienstr3); 

and ocr2.cpp

#include <sstream> #include <string> #include <iostream> #include <cstring> #include <fstream>  using namespace std; // il s'agit d'un exemple de variable exportée ocr2_api int nocr2=0;  // il s'agit d'un exemple de fonction exportée. ocr2_api int fnocr2(void) {     return 42; }   ocr2_api bool comparer(bool latin, string lieninitial, string lienstr1, string lienstr2, string lienstr3) { // function }  cocr2::cocr2() {     return; } 

while building project, have error c2061 in visual studio 2015 description :

"erreur de syntaxe : identificateur 'string'"

which means "syntax error : identifiable 'string'.

i want know if way used create dll correct, if yes, why have error while building?

thank you

you need add
#include < string > header file ,
#include "ocr2.h" source file.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -