void CZhaoyn_GetIPView::OnDraw(CDC* pDC)
{
CZhaoyn_GetIPDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here char name[50];
gethostname(name,50);
CString strName;
strName = name; HDC hdc = ::GetDC( m_hWnd );
TextOut(hdc,200,200,strName,strName.GetLength());
}
错误是:error LNK2001: unresolved external symbol __imp__gethostname@8是什么原因呢?(跟头文件有关吗)
{
CZhaoyn_GetIPDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here char name[50];
gethostname(name,50);
CString strName;
strName = name; HDC hdc = ::GetDC( m_hWnd );
TextOut(hdc,200,200,strName,strName.GetLength());
}
错误是:error LNK2001: unresolved external symbol __imp__gethostname@8是什么原因呢?(跟头文件有关吗)
解决方案 »
- 设置多次SetEvent, 只成功激活了线程一次???
- 关于抓取后的编码问题
- 请问如何改变菜单顶部颜色?
- 连接数据库
- 请教各位大侠:如何用VC程序修改系统时间?
- 大侠们回答一下我的问题吧:http://expert.csdn.net/Expert/topic/2251/2251045.xml?temp=7.549685E-02
- 程序打包完毕生成安装程序//怎么可以也让bat一起安装?
- 鼠标钩子遇到的灵异事件
- VC网络编程问题,我想入门!
- 请问大家象CRT0.C这样的RUNTIME启动代码在那里可以找的到?
- mfc listctrl缓存技术
- eVC debug下没有错误,release下出现不能解析外部符号
关于WSAStartup,msdn是这样写的:
WORD wVersionRequested;
WSADATA wsaData;
int err;
wVersionRequested = MAKEWORD( 2, 2 );
err = WSAStartup( wVersionRequested, &wsaData );
if ( err != 0 ) {
/* Tell the user that we could not find a usable */
/* WinSock DLL. */
return 1;
}
/* Confirm that the WinSock DLL supports 2.2.*/
/* Note that if the DLL supports versions greater */
/* than 2.2 in addition to 2.2, it will still return */
/* 2.2 in wVersion since that is the version we */
/* requested. */
if ( LOBYTE( wsaData.wVersion ) != 2 ||
HIBYTE( wsaData.wVersion ) != 2 ) {
/* Tell the user that we could not find a usable */
/* WinSock DLL. */
WSACleanup( );
return 1;
}
/* The WinSock DLL is acceptable. Proceed. */
#pragma comment(lib, "ws2_32")Zhaoyn_GetIPView.cpp 文件中加:CZhaoyn_GetIPView::CZhaoyn_GetIPView()
{
// TODO: add construction code here
WORD wVersionRequested;
WSADATA wsaData;
wVersionRequested = MAKEWORD( 2, 2 );
WSAStartup( wVersionRequested, &wsaData );}