I am tring to create a dll.I get the following error while linking with 238 warnings.
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall TraceNo::TraceNo(char const *)" (__imp_??0TraceNo@@QAE@PBD
@Z)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall TraceNo::~TraceNo(void)" (__imp_??1TraceNo@@QAE@XZ)
ordertot.obj : error LNK2001: unresolved external symbol "public: virtual class NC_OverridableFunction * __thiscall NC_OverridableFunction::Cl
one(void)"
(?Clone@NC_OverridableFunc
tion@@UAEP
AV1@XZ)
ordertot.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall NC_Object::FailedRegistrat
ion(class NC_RegistrationID &,class ErrorMsg_Reg const *)" (?FailedRegistration@NC_Ob
ject@@UAEX
AAVNC_Regi
strationID
@@PBVError
Msg_Reg@
@@Z)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall NC_OverridableFunction::~N
C_Overrida
bleFunctio
n(void)" (__imp_??1NC_OverridableFu
nction@@UA
E@XZ)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class FuncName const _STR_CONSTRUCTOR" (__imp_?_STR_CONSTRUCTOR@@
3VFuncName
@@B)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall NC_OverridableFunction::NC
_Overridab
leFunction
(void)" (__imp_??0NC_OverridableFu
nction@@QA
E@XZ)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class FuncName const _STR_DESTRUCTOR" (__imp_?_STR_DESTRUCTOR@@3
VFuncName@
@B)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class String & __thiscall String::operator<<(double)
" (__imp_??6String@@QAEAAV0@
N@Z)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class String & __thiscall String::Clean(void)" (__imp_?Clean@String@@QAEA
AV1@XZ)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall SQL::~SQL(void)" (__imp_??1SQL@@QAE@XZ)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class Error & __thiscall Error::operator<<(char const *)" (__imp_??6Error@@QAEAAV0@P
BD@Z)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: int __thiscall SQL::ReportError(void)" (__imp_?ReportError@SQL@@Q
AEHXZ)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: int __thiscall SQL::getSQLrc(void)" (__imp_?getSQLrc@SQL@@QAEH
XZ)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall SQL::SQL(class DataBase &,class String const &)" (__imp_??0SQL@@QAE@AAVData
Base@@ABVS
tring@@@Z)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class DataBase * __cdecl DataBaseManager::GetCurren
tDataBase(
void)" (__imp_?GetCurrentDataBase
@DataBaseM
anager@@SA
PAVDataBas
e@@XZ)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class String & __thiscall String::operator<<(class String const &)" (__imp_??6String@@QAEAAV0@
ABV0@@Z)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class String const & __thiscall NVPHash::Get(class String const &,class String const &)const " (__imp_?Get@NVPHash@@QBEAB
VString@@A
BV2@0@Z)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class NameValuePairMap const & __thiscall HttpRequest::getNVPs(void)
const " (__imp_?getNVPs@HttpReques
t@@QBEABVN
ameValuePa
irMap@@XZ)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class StringWithOwnership const _STR_EMPTY_" (__imp_?_STR_EMPTY_@@3VStr
ingWithOwn
ership@@B)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall String::String(char const *)" (__imp_??0String@@QAE@PBD@
Z)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class StringWithOwnership const _PARAM_NAME_MERCHANT_REF_N
UM" (__imp_?_PARAM_NAME_MERCHA
NT_REF_NUM
@@3VString
WithOwners
hip@@B)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall String::~String(void)" (__imp_??1String@@UAE@XZ)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class Error & __cdecl Error::nls(class ErrorMsg const *,...)" (__imp_?nls@Error@@QAAAAV1
@PBVErrorM
sg@@ZZ)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class ErrorMsg_API const _API_CANT_FIND_IN_ENV" (__imp_?_API_CANT_FIND_IN_
ENV@@3VErr
orMsg_API@
@B)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: char const * __thiscall String::c_str(void)const " (__imp_?c_str@String@@QBEP
BDXZ)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class Error & __thiscall Error::operator<<(class Error & (__cdecl*)(class Error &))" (__imp_??6Error@@QAEAAV0@P
6AAAV0@AAV
0@@Z@Z)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class Error error" (__imp_?error@@3VError@@A)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class NC_Void * __thiscall NC_Environment::Seek(class
String const &)" (__imp_?Seek@NC_Environmen
t@@QAEPAVN
C_Void@@AB
VString@@@
Z)
ordertot.obj : error LNK2001: unresolved external symbol "class StringWithOwnership const _PARAM_NAME_ORDER_REF_NUM"
(?_PARAM_NAME_ORDER_REF_NU
M@@3VStrin
gWithOwner
ship@@B)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class String & __thiscall String::operator<<(char const *)" (__imp_??6String@@QAEAAV0@
PBD@Z)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall String::String(class String const &)" (__imp_??0String@@QAE@ABV0
@@Z)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall NC_OverridableFunction::NC
_Overridab
leFunction
(class NC_OverridableFunction const &)" (__imp_??0NC_OverridableFu
nction@@QA
E@ABV0@@Z)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class NC_OverridableFunction & __thiscall NC_OverridableFunction::op
erator=(cl
ass NC_OverridableFunction const &)" (__imp_??4NC_OverridableFu
nction@@QA
EAAV0@ABV0
@@Z)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall ClassName::ClassName(char const *)" (__imp_??0ClassName@@QAE@P
BD@Z)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall ClassName::~ClassName(void
)" (__imp_??1ClassName@@UAE@X
Z)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: int __thiscall NC_OverridableFunctionMana
ger::Regis
terOverrid
ableFuncti
on(class String const &,class String const &,class String const &,double,class NC_Overrida
bleFunction *)" (__imp_?RegisterOverridabl
eFunction@
NC_Overrid
ableFuncti
onManager@
@QAEHABVSt
ring@@00NP
AVNC_Overr
idableFunc
tion@@@Z)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class NC_OverridableFunctionMana
ger & __cdecl NC_OverridableFunctionMana
ger::GetUn
iqueInstan
ce(void)" (__imp_?GetUniqueInstance@
NC_Overrid
ableFuncti
onMana
ger@@SAAAV1@XZ)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall Error::endl(void)" (__imp_?endl@Error@@QAEXXZ
)
ordertot.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall Error::indent(void)" (__imp_?indent@Error@@QAEX
XZ)
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/ordertot.exe : fatal error LNK1120: 41 unresolved externals
Error executing link.exe.
ordertot.exe - 42 error(s), 238 warning(s)
My code is as given below .I have included all the necessary headers.There seems to be some problem with _declspec.Please help.
#include "objects/objects.pch"
#include<winbase.h>
#if defined (WIN32)
#define __DLL_NCS_API__ __declspec(dllexport)
#elif defined(AIX)
#define __DLL_NCS_API__
#endif
#include "tasks_api.h"
//========================
==========
==========
==========
==========
==========
==========
====
//========================
==========
==========
==========
==========
==========
==========
====
//#define __TRACE_NCAPIS__
#ifdef __TRACE_NCAPIS__
typedef TraceYes Trace;
#else
typedef TraceNo Trace;
#endif
static Trace trace("NC_APIS ("__FILE__")");
//========================
==========
==========
==========
==========
==========
==========
====
static const double SIGMA = 0.000001;
//////////////////////////
//////////
//////////
//////////
//////////
//////////
//////////
////
//
// GetOrdProdTot
//
//
//class __declspec(dllexport) GetOrdProdTot : public NC_OverridableFunction
class __DLL_NCS_API__ GetOrdProdTot : public NC_OverridableFunction
{
static const ClassName _STR_ThisClass;
public:
GetOrdProdTot()
{
Trace::Tracer T(_STR_CONSTRUCTOR, _STR_ThisClass);
}
virtual ~GetOrdProdTot()
{
Trace::Tracer T(_STR_DESTRUCTOR, _STR_ThisClass);
}
void operator delete(void* p) { ::delete p; }
public:
virtual bool Process(const HttpRequest& Req, HttpResponse& Res, NC_Environment& Env)
{
// Set the error handler.
String ErrTaskName(_TaskName);
ErrTaskName << "_ERR";
// Input Parameters:
const String* OrderRefNum = (const String *) Env.Seek(_PARAM_NAME_ORDER
_REF_NUM);
if (OrderRefNum == NULL)
{
error << indent; error.nls(&_API_CANT_FIND_
IN_ENV, _PARAM_NAME_ORDER_REF_NUM.
c_str()) << endl;
return false;
}
const String* MerchantRefNum = (const String *) Env.Seek(_PARAM_NAME_MERCH
ANT_REF_NU
M);
if (MerchantRefNum == NULL)
{
error << indent; error.nls(&_API_CANT_FIND_
IN_ENV, _PARAM_NAME_MERCHANT_REF_N
UM.c_str()
) << endl;
return false;
}
// Output Parameters:
// String *ProductPrice = (String *) Env.Seek(_PARAM_NAME_PRODU
CT_PRICE);
// if (ProductPrice == NULL)
// {
// error << indent; error.nls(&_API_CANT_FIND_
IN_ENV, _PARAM_NAME_PRODUCT_PRICE.
c_str()) << endl;
// return false;
// }
double disc=atof(Req.getNVPs().Ge
t("myamt")
.c_str());
String stmt;
stmt << "UPDATE orders SET orprtot=orprtot+discamt"
<< "WHERE orrfnbr=" << *OrderRefNum
<< "and ormenbr=" << *MerchantRefNum;
SQL Sql(*(DataBaseManager::Get
CurrentDat
aBase()), stmt);
if (Sql.getSQLrc() != ERR_DB_NO_ERROR)
{
Sql.ReportError();
error << "Update after lump" << endl;
return false;
}
stmt.Clean();
stmt << "UPDATE orders SET discamt=0"
<< "WHERE orrfnbr=" << *OrderRefNum
<< "and ormenbr=" << *MerchantRefNum;
SQL Sql1(*(DataBaseManager::Ge
tCurrentDa
taBase()),
stmt);
if (Sql1.getSQLrc() != ERR_DB_NO_ERROR)
{
Sql1.ReportError();
error << "Update after lump" << endl;
return false;
}
stmt.Clean();
stmt << "UPDATE orders SET discamt="<<disc<<","
<< "SET orprtot=orprtot+" << disc;
SQL Sql2(*(DataBaseManager::Ge
tCurrentDa
taBase()),
stmt);
if (Sql2.getSQLrc() != ERR_DB_NO_ERROR)
{
Sql2.ReportError();
error << "Update after lump" << endl;
return false;
}
return true;
}
};
const ClassName GetOrdProdTot::_STR_ThisCl
ass("GetOr
dProdTot")
;
static bool X2 = NC_OverridableFunctionMana
ger::GetUn
iqueInstan
ce().Regis
terApi
( "IBM", "NC", "GetOrdProdTot", 1.0, new GetOrdProdTot );