Hello friends,
I am new to windows programming .
I am trying to create DLL using visual studio 12 .
I have 2 files source.cpp and header.h
header.h contains function body and i am using it in source.cpp.
header.h
---------
#include<iostream>
using nampspace std;
void display()
{cout<<"hello world"<<endl
}
source.cpp
----------
#include"header.h"
int main()
{
display();
return 0;
}
----------
I am able to create .o file for source.cpp.
to create DLL i used command
link /DLL /out:mydll.dll source.o
but it is giving me error :
======================
Source4.o : error LNK2019: unresolved external symbol __main referenced in
function main
Source4.o : error LNK2019: unresolved external symbol
_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc referenced in
function _Z7displayv
Source4.o : error LNK2019: unresolved external symbol _ZNSolsEPFRSoS_E
referenced in function _Z7displayv
Source4.o : error LNK2019: unresolved external symbol
_ZNSt8ios_base4InitC1Ev referenced in function
_Z41__static_initialization_and_destruction_0ii
Source4.o : error LNK2019: unresolved external symbol __cxa_atexit
referenced in function _Z41__static_initialization_and_destruction_0ii
Source4.o : error LNK2001: unresolved external symbol _ZNSt8ios_base4InitD1Ev
Source4.o : error LNK2001: unresolved external symbol __dso_handle
Source4.o : error LNK2001: unresolved external symbol
_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
Source4.o : error LNK2001: unresolved external symbol _ZSt4cout
LINK : error LNK2001: unresolved external symbol _DllMainCRTStartup
mydll.dll : fatal error LNK1120: 10 unresolved externals
===========================
Can anyone help me ..how can i resolve this problem?
Is there any way to include header file during creation of DLL.