wxIPV4address causes 10 errors Topic is solved

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
Ged 512
In need of some credit
In need of some credit
Posts: 2
Joined: Fri Dec 13, 2019 2:02 am

wxIPV4address causes 10 errors

Post by Ged 512 » Fri Dec 13, 2019 2:14 am

Can you please help me. I am trying to convert a program from wxWidgets 2.8 to 3.1.3.
Most code required only minor adjustments, but network communication with TCP fails completely.

I am using: Windows 10, wxWidgets 3.1.3, Mingw32-gcc-5.1.0 and CodeBlocks 17.12

This code:

Code: Select all

#include <wx/socket.h>

    wxString hostname = "192.168.1.111";       // Arduino
    wxIPV4address addr;
    addr.Hostname(hostname);

Produces 10 errors and so do all other TCPIP function calls.

Here is the CodeBlocks build log:

-------------- Clean: Release in AAA313 (compiler: GNU GCC Compiler)---------------

Cleaned "AAA313 - Release"

-------------- Build: Release in AAA313 (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -g -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -g -g -IC:\wxWidgets_3.1.3\include -IC:\wxWidgets_3.1.3\lib\gcc_dll\mswu -c C:\Users\gkirc\Documents\AAA313\AAA313App.cpp -o obj\Release\AAA313App.o
mingw32-g++.exe -Wall -g -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -g -g -IC:\wxWidgets_3.1.3\include -IC:\wxWidgets_3.1.3\lib\gcc_dll\mswu -c C:\Users\gkirc\Documents\AAA313\AAA313Main.cpp -o obj\Release\AAA313Main.o
windres.exe -IC:\wxWidgets_3.1.3\include -IC:\wxWidgets_3.1.3\lib\gcc_dll\mswu  -J rc -O coff -i C:\Users\gkirc\DOCUME~1\AAA313\resource.rc -o obj\Release\resource.res
mingw32-g++.exe -LC:\wxWidgets_3.1.3\lib\gcc_dll -o bin\Release\AAA313.exe obj\Release\AAA313App.o obj\Release\AAA313Main.o  obj\Release\resource.res -mthreads  -lwxmsw31u_core -lwxbase31u -lwxpng -lwxzlib -mwindows
obj\Release\AAA313Main.o: In function `ZN11AAA313FrameC2EP8wxWindowi':
C:/Users/gkirc/Documents/AAA313/AAA313Main.cpp:91: undefined reference to `_imp___ZN11wxIPaddress8HostnameERK8wxString'
obj\Release\AAA313Main.o: In function `ZN11wxIPaddressD2Ev':
C:/wxWidgets_3.1.3/include/wx/sckaddr.h:71: undefined reference to `_imp___ZTV11wxIPaddress'
C:/wxWidgets_3.1.3/include/wx/sckaddr.h:71: undefined reference to `_imp___ZN13wxSockAddressD2Ev'
C:/wxWidgets_3.1.3/include/wx/sckaddr.h:71: undefined reference to `_imp___ZN13wxSockAddressD2Ev'
obj\Release\AAA313Main.o: In function `ZN11wxIPaddressC2Ev':
C:/wxWidgets_3.1.3/include/wx/sckaddr.h:71: undefined reference to `_imp___ZN13wxSockAddressC2Ev'
C:/wxWidgets_3.1.3/include/wx/sckaddr.h:71: undefined reference to `_imp___ZTV11wxIPaddress'
C:/wxWidgets_3.1.3/include/wx/sckaddr.h:71: undefined reference to `_imp___ZN13wxSockAddressD2Ev'
obj\Release\AAA313Main.o: In function `ZN13wxIPV4addressC1Ev':
C:/wxWidgets_3.1.3/include/wx/sckaddr.h:113: undefined reference to `_imp___ZTV13wxIPV4address'
obj\Release\AAA313Main.o: In function `ZN13wxIPV4addressD1Ev':
C:/wxWidgets_3.1.3/include/wx/sckaddr.h:113: undefined reference to `_imp___ZTV13wxIPV4address'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 2 second(s))
10 error(s), 0 warning(s) (0 minute(s), 2 second(s))
Last edited by DavidHart on Fri Dec 13, 2019 9:41 am, edited 1 time in total.
Reason: Added code-tags

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2157
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxIPV4address causes 10 errors

Post by PB » Fri Dec 13, 2019 8:02 am

When you get undefined reference errors, it means that you did not tell the linker about some libraries your application needs.

As your errors are for a network class, I would guess you need to add wxbase31u_net library.

BTW, I would also recommend using a GCC newer than 5.1 for wxWidgets 3.1.3.

Ged 512
In need of some credit
In need of some credit
Posts: 2
Joined: Fri Dec 13, 2019 2:02 am

Re: wxIPV4address causes 10 errors

Post by Ged 512 » Sat Dec 14, 2019 9:07 am

Thanks, that fixed my problem

Post Reply