Hello,
I'm developing a Qt (4.6.1) application with QtCreator (1.3.1), but I'm not able to link it agains libws2_32
The .pro file:
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# -------------------------------------------------
# Project created by QtCreator 2010-01-21T00:17:12
# -------------------------------------------------
TARGET = RSOClient
TEMPLATE = app
#LIBS += -LE:\boost\bin.v2\libs\regex\build\gcc-mingw-4.4.0\release\link-static\threading-multi -lboost_regex-mgw44-mt-1_42
LIBS += -lws2_32 -lwsock32
SOURCES += main.cpp \
mainwindow.cpp \
../../win/sockets/clsSocket/clsSocket.cpp \
../../clsClientSocket/clsClientSocket.cpp \
../../utils/string_functions.cpp
HEADERS += mainwindow.hpp \
../../win/sockets/clsSocket/clsSocket.hpp \
../../clsClientSocket/clsClientSocket.hpp \
../../utils/string_functions.hpp
FORMS += mainwindow.ui
INCLUDEPATH += ../../win \
e:/boost
|
And the compiler's (mingw) output is:
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
Ejecutando los pasos para construir el proyecto RSOClient...
Iniciando: E:/Qt/2010.01/mingw/bin/mingw32-make.exe clean -w
mingw32-make: Entering directory `E:/eloy/c++/RSOQtClient/RSOClient'
e:\qt\2010.01\qt\bin\qmake.exe -spec ..\..\..\..\Qt\2010.01\qt\mkspecs\win32-g++ -win32 -o Makefile RSOClient.pro
mingw32-make: Leaving directory `E:/eloy/c++/RSOQtClient/RSOClient'
mingw32-make: Entering directory `E:/eloy/c++/RSOQtClient/RSOClient'
E:/Qt/2010.01/mingw/bin/mingw32-make -f Makefile.Debug clean
mingw32-make[1]: Entering directory `E:/eloy/c++/RSOQtClient/RSOClient'
del debug\moc_mainwindow.cpp
del ui_mainwindow.h
del debug\main.o debug\mainwindow.o debug\clsSocket.o debug\clsClientSocket.o debug\string_functions.o debug\moc_mainwindow.o
No se encuentra E:\eloy\c++\RSOQtClient\RSOClient\debug\moc_mainwindow.cpp
mingw32-make[1]: Leaving directory `E:/eloy/c++/RSOQtClient/RSOClient'
E:/Qt/2010.01/mingw/bin/mingw32-make -f Makefile.Release clean
mingw32-make[1]: Entering directory `E:/eloy/c++/RSOQtClient/RSOClient'
del release\moc_mainwindow.cpp
del ui_mainwindow.h
del release\main.o release\mainwindow.o release\clsSocket.o release\clsClientSocket.o release\string_functions.o release\moc_mainwindow.o
mingw32-make[1]: Leaving directory `E:/eloy/c++/RSOQtClient/RSOClient'
mingw32-make: Leaving directory `E:/eloy/c++/RSOQtClient/RSOClient'
No se encuentra E:\eloy\c++\RSOQtClient\RSOClient\release\moc_mainwindow.cpp
No se encuentra E:\eloy\c++\RSOQtClient\RSOClient\ui_mainwindow.h
No se encuentra E:\eloy\c++\RSOQtClient\RSOClient\release\main.o
Finalizado retornando 0.
Configuration intacta, saltando paso QMake.
Iniciando: E:/Qt/2010.01/mingw/bin/mingw32-make.exe -w
mingw32-make: Entering directory `E:/eloy/c++/RSOQtClient/RSOClient'
E:/Qt/2010.01/mingw/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `E:/eloy/c++/RSOQtClient/RSOClient'
e:\Qt\2010.01\qt\bin\uic.exe mainwindow.ui -o ui_mainwindow.h
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\..\..\Qt\2010.01\qt\include\QtCore" -I"..\..\..\..\Qt\2010.01\qt\include\QtGui" -I"..\..\..\..\Qt\2010.01\qt\include" -I"..\..\win" -I"..\..\..\..\boost" -I"..\..\..\..\Qt\2010.01\qt\include\ActiveQt" -I"debug" -I"." -I"..\..\..\..\Qt\2010.01\qt\mkspecs\win32-g++" -o debug\main.o main.cpp
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\..\..\Qt\2010.01\qt\include\QtCore" -I"..\..\..\..\Qt\2010.01\qt\include\QtGui" -I"..\..\..\..\Qt\2010.01\qt\include" -I"..\..\win" -I"..\..\..\..\boost" -I"..\..\..\..\Qt\2010.01\qt\include\ActiveQt" -I"debug" -I"." -I"..\..\..\..\Qt\2010.01\qt\mkspecs\win32-g++" -o debug\mainwindow.o mainwindow.cpp
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\..\..\Qt\2010.01\qt\include\QtCore" -I"..\..\..\..\Qt\2010.01\qt\include\QtGui" -I"..\..\..\..\Qt\2010.01\qt\include" -I"..\..\win" -I"..\..\..\..\boost" -I"..\..\..\..\Qt\2010.01\qt\include\ActiveQt" -I"debug" -I"." -I"..\..\..\..\Qt\2010.01\qt\mkspecs\win32-g++" -o debug\clsSocket.o ..\..\win\sockets\clsSocket\clsSocket.cpp
..\..\win\sockets\clsSocket\clsSocket.cpp: In member function 'bool clsSocket::ConnectSocket()':
..\..\win\sockets\clsSocket\clsSocket.cpp:416: error: 'getaddrinfo' no se declaró en este ámbito
..\..\win\sockets\clsSocket\clsSocket.cpp:441: error: 'freeaddrinfo' no se declaró en este ámbito
..\..\win\sockets\clsSocket\clsSocket.cpp: In member function 'bool clsSocket::Listen()':
..\..\win\sockets\clsSocket\clsSocket.cpp:713: error: 'getaddrinfo' no se declaró en este ámbito
..\..\win\sockets\clsSocket\clsSocket.cpp:751: error: 'freeaddrinfo' no se declaró en este ámbito
mingw32-make[1]: Leaving directory `E:/eloy/c++/RSOQtClient/RSOClient'
mingw32-make[1]: *** [debug/clsSocket.o] Error 1
mingw32-make: Leaving directory `E:/eloy/c++/RSOQtClient/RSOClient'
mingw32-make: *** [debug] Error 2
Finalizado retornando 2.
Error durante la construcción del proyecto RSOClient
Mientras se ejecutaba la etapa 'Make'
|
QtCreator is in spanish, and the errors translated to english are:
..\..\win\sockets\clsSocket\clsSocket.cpp: In member function 'bool clsSocket::ConnectSocket()':
..\..\win\sockets\clsSocket\clsSocket.cpp:416: error: 'getaddrinfo' was not declared in this scope
..\..\win\sockets\clsSocket\clsSocket.cpp:441: error: 'freeaddrinfo' was not declared in this scope
..\..\win\sockets\clsSocket\clsSocket.cpp: In member function 'bool was not declared in this scope
..\..\win\sockets\clsSocket\clsSocket.cpp:713: error: 'getaddrinfo' was not declared in this scope
..\..\win\sockets\clsSocket\clsSocket.cpp:751: error: 'freeaddrinfo' was not declared in this scope
As you can see in the g++ calls the is no library at all, what makes no sense because the .pro file has the LIBS var defined. If I open the Makefile.debug file, I can see that the libraries are well defined:
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
CC = gcc
CXX = g++
DEFINES = -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN
CFLAGS = -g -Wall $(DEFINES)
CXXFLAGS = -g -frtti -fexceptions -mthreads -Wall $(DEFINES)
INCPATH = -I"..\..\..\..\Qt\2010.01\qt\include\QtCore" -I"..\..\..\..\Qt\2010.01\qt\include\QtGui" -I"..\..\..\..\Qt\2010.01\qt\include" -I"..\..\win" -I"..\..\..\..\boost" -I"..\..\..\..\Qt\2010.01\qt\include\ActiveQt" -I"debug" -I"." -I"..\..\..\..\Qt\2010.01\qt\mkspecs\win32-g++"
LINK = g++
LFLAGS = -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows
LIBS = -L"e:\Qt\2010.01\qt\lib" -lmingw32 -lqtmaind -lws2_32 -lwsock32 -lQtGuid4 -lQtCored4
QMAKE = e:\qt\2010.01\qt\bin\qmake.exe
IDC = e:\Qt\2010.01\qt\bin\idc.exe
IDL = midl
ZIP = zip -r -9
DEF_FILE =
RES_FILE =
COPY = copy /y
COPY_FILE = $(COPY)
COPY_DIR = xcopy /s /q /y /i
DEL_FILE = del
DEL_DIR = rmdir
MOVE = move
CHK_DIR_EXISTS= if not exist
MKDIR = mkdir
INSTALL_FILE = $(COPY_FILE)
INSTALL_PROGRAM = $(COPY_FILE)
INSTALL_DIR = $(COPY_DIR)
|
Does anybody know what am I doing wrong?
Best regards,
Eloy.