简体   繁体   English

Visual Studio无法在32位上链接,但可以在64位上链接

[英]Visual Studio cant link on 32 bit but can on 64bit

I created a project and as I always do I created 2 platforms (64 and 32 bit) (this is a DLL). 我创建了一个项目,并且一如既往地创建了2个平台(64位和32位)(这是一个DLL)。 I wrote the code and tested it and everything went great (I always test on 64bit configuration) but as I wanted to test on my 32bit XP VM I struggle a LINK problem. 我编写了代码并对其进行了测试,然后一切都变好了(我始终在64位配置上进行测试),但是当我想在32位XP VM上进行测试时,我遇到了LINK问题。

I am using the API WSASelectEvent in my code (as a lot of other WSA/Winsock apis) but in 32 bit configuration and only in 32 bit configuration the linker refuse to find _WSASelectEvent. 我在代码中使用了WSASelectEvent API(与许多其他WSA / Winsock API一样),但是在32位配置中,仅在32位配置中,链接器拒绝找到_WSASelectEvent。

I get the well known LNK2001 error : 我得到了众所周知的LNK2001错误:

"error LNK2001: unresolved external symbol _WSAEventSelect" “错误LNK2001:无法解析的外部符号_WSAEventSelect”

I sure link to ws2_32.lib and I sure include winsock2.h as I use other apis (such as WSAStartup and WSACleanup and structs and whatnot in my code, obviously to use winsockets). 我肯定链接到ws2_32.lib,并且当我使用其他API(例如WSAStartup和WSACleanup以及结构和代码中未包含的其他东西,显然要使用winsockets)时,肯定包括winsock2.h。

so knowing me liking to mess around with configuration mid-work (this is a rather small project nothing too big) I decided ill go for sure and created a new project in visual studio place the code in and create a new platform to compile in (with the GUI of-course) but I've got the same results. 所以知道我喜欢搞混配置工作(这是一个很小的项目,没什么大不了),所以我决定确定并在Visual Studio中创建了一个新项目,将代码放入其中,并创建了一个新平台进行编译(与课程的GUI),但我得到了相同的结果。

I have been for 2-3 hours surfing the net to no fix and I even tried comparing the compile command line and link command line which apart of the normal /MACHINE:x64/x86 and target folders is exactly the same. 我已经花了2到3个小时上网冲浪,甚至无法修复,我什至尝试比较编译命令行和链接命令行,除了正常的/ MACHINE:x64 / x86和目标文件夹外,它们完全相同。

do you maybe know this problem or a solution to it? 您可能知道这个问题或解决方案吗?

NOTE:: intellisense warn me about this and visual studio wont suggest parameters list when WSASelectEvent( is written, but "Go to Definition" sure takes me to Winsock2.h. 注意:: intellisense会警告我有关此信息,并且在编写WSASelectEvent()时Visual Studio不会建议参数列表,但是“转到定义”肯定会将我带到Winsock2.h。

SOLVED, 解决了,

ok so apparently I did a mess with the inclusion of my own libraries. 好的,显然我把自己的库包含进来一团糟。 after including winsock2.h in couple of other places I managed to compile it on 32 bit aswell. 在其他几个地方包含winsock2.h之后,我也设法在32位上进行了编译。

Thanks for your time! 谢谢你的时间!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM