I started QT and trying to write some small programs. In one program
, I wanted to send mail. Found a code how to send mail in C++ (uses winsock
library, not QT’s) and integrated it to my program. But how, I gives some bunch of errors. They were linking errors.
... /mailer.cpp:17: undefined reference to `WSAStartup@8'
...
Then a little research helped to me: This link.
Open your project file (<projectname>.pro
):
and add the line:
LIBS += < WHERE-YOUR-LIBRARY-FILE-IS-LOCATED >
If your library is located in [QTDIR]\mingw\lib
directory, you can just add the name of it (without its filename extension: .a):
LIBS += libwsock32
If you are developing in linux, the default library directory(or one of the library directories) might be /usr/lib
.