VC ++ Express和Windows平台SDK,以及Windows Vista 64->链接错误 [英] VC++ express and windows platform sdk, and windows vista 64 --> link errors
问题描述
我在创建一个简单的套接字测试程序时遇到了问题.我有以下代码:
I'm having a problem creating a simple sockets test program. I've got the following code:
#include < winsock2.h>
#include <winsock2.h>
#include < ws2tcpip.h>
#include <ws2tcpip.h>
int main( int argc, 字符 * argv [])
int main(int argc, char * argv[])
{
WSADATA wsaData;
WSADATA wsaData;
int iResult;
int iResult;
//初始化Winsock
// Initialize Winsock
iResult = WSAStartup(MAKEWORD(2,2),& wsaData);
iResult = WSAStartup(MAKEWORD(2,2), &wsaData);
如果 (iResult!= 0)
if (iResult != 0)
{
printf( " WSAStartup失败:%d \ n" ,iResult);
printf("WSAStartup failed: %d\n", iResult);
返回 1;
return 1;
}
等...
我也已经安装了Windows平台sdk并安装了它,并且我有指向使用ws2_32.lib的链接器配置,但是我遇到了诸如以下这样的未解析符号的链接错误:
I've also got the windows platform sdk and have it installed, and I have the linker config pointing to use ws2_32.lib, but I get link errors about unresolved symbols like this:
1> hellocpp.obj:错误LNK2019:函数_main中引用的未解析的外部符号__imp__WSAStartup @ 8
1>hellocpp.obj : error LNK2019: unresolved external symbol __imp__WSAStartup@8 referenced in function _main
我在链接器选项中打开了详细信息,我看到了:
I turned on verbose in the linker options, and I see this:
1>搜索库
1>搜索C:\ Program Files \ Microsoft SDKs \ Windows \ v6.0 \ Lib \ x64 \ ws2_32.lib:
1> Searching C:\Program Files\Microsoft SDKs\Windows\v6.0\Lib\x64\ws2_32.lib:
1>搜索C:\ Program Files \ Microsoft SDKs \ Windows \ v6.0 \ Lib \ x64 \ kernel32.lib:
1> Searching C:\Program Files\Microsoft SDKs\Windows\v6.0\Lib\x64\kernel32.lib:
1>搜索C:\ Program Files(x86)\ Microsoft Visual Studio 8 \ VC \ lib \ LIBCMTD.lib:
1> Searching C:\Program Files (x86)\Microsoft Visual Studio 8\VC\lib\LIBCMTD.lib:
1>找到了_memset
1> Found _memset
1>在hellocpp.obj
1> Referenced in hellocpp.obj
....
所以,我猜测它可以找到我的ws2_32.lib,但似乎没有在其中找到对lib函数的任何有用的引用.
so, I'm guessing it can find my ws2_32.lib, but it doesn't seem to find any useful references to lib functions inside it.
我正在使用Vista的64位版本,因此,我几乎可以猜测的是,我可能下载了错误的库或其他内容.
I'm using the 64 bit version of vista, so, about all I can guess is that I may have downloaded the wrong libs or something..
有人知道我可能做错了什么吗?
anyone have any info about what I may be doing wrong?
谢谢!
Thanks!
推荐答案
我会在寻求帮助之前先搜索MSDN;如:
I would search the MSDN before asking for assistance; as in:
Using that, I found Creating a Basic Winsock Application (Windows). Does that help?
这篇关于VC ++ Express和Windows平台SDK,以及Windows Vista 64->链接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!