hi, i am still a little confusing about the import external lib.
here is the problem i met.i just want to know y?
there has a lib called extlib.lib,and it contains a function called
GetCurveList, i don’t have the header file of extlib.lib,but i know the interface of extlib.lib .so i create a dummy header file,dummy.h
#ifndef DUMMY_H
#define DUMMY_H
#include <vector>
#include <string>
using namespace std;
#ifndef __MAKECINT__
int GetCurveList(const char *name, vector<string> &list);
#else
int GetCurveList(const char *name, vector<string> &list);
#pragma link C++ function GetCurveList;
#endif
#endif
then i typed
makecint -mk Makefile -dl libext.dll -H dummy.h -l extlib.lib
make
the link process is error,it response:
G__cpp_libext.obj : error LNK2019: unresolved external symbol "int __cdecl Get
urveList(char const *,class std::vector<class std::basic_string<char,struct std
:char_traits<char>,class std::allocator<char> >,class std::allocator<class std:
basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >
&)" (?GetCurveList@@YAHPBDAAV?$vector@V?$basic_string@DU?$char_traits@D@std@@V
$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$all
cator@D@2@@std@@@2@@std@@@Z) ,this symbol is referenced in the function "int __cdecl G__libext__65
9376_0(struct G__value *,char const *,struct G__param *,int)" (?G__libext__6579376_0@@YAHPAUG__value@@PBDPAUG__param@@H@Z)
but when i change the dummy.h as below:
#ifndef DUMMY_H
#define DUMMY_H
#include <vector>
#include <string>
using namespace std;
#ifndef __MAKECINT__
int GetCurveList(const char *name, vector<string> &list);
#else
[b]//int GetCurveList(const char *name, vector<string> &list);[/b]
#pragma link C++ function GetCurveList;
#endif
#endif
the link process is okay.
just a warning said
Note: link requested for unknown function GetCurveList dummy.h(12)
y does this happens?
i am a littel confused about the three parts of dummy file.(before the “#ifndef MAKECINT”,between the “#ifndef MAKECINT” and “#else”,and after the “#else”).
i know that the first part is processed by the cint and the cl.exe.
the second part is only processed by cl.exe.
the third part is only processed by the cint.exe.
but y here when i add a declaration of function,it says error?
i don’t think it should be error.