K
K
kingslayer2022-04-17 21:19:46
MinGW
kingslayer, 2022-04-17 21:19:46

Why is #pragma comment (lib) not parsed?

#pragma comment (lib, "Ws2_32.lib")added to the code, but still throwing errors.

C:\Users\A-TECH~1\AppData\Local\Temp\ccMoTqr8.o	main.cpp:(.text+0x4f): undefined reference to `__imp_WSAStartup'
C:\Users\A-TECH~1\AppData\Local\Temp\ccMoTqr8.o	main.cpp:(.text+0x101): undefined reference to `__imp_WSACleanup'
C:\Users\A-TECH~1\AppData\Local\Temp\ccMoTqr8.o	main.cpp:(.text+0x137): undefined reference to `__imp_socket'

What's wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mercury13, 2022-04-18
@Mercury13

Judging by the __imp decoration and the *.o extension, you are using the VS pragma on MinGW. Since I don't know what programming system you are on, go to the project settings and include the ws2_32 library.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question