Identifier "wxZipStreamLink" is undefined + unresolved externals 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.
Tapsa
Earned some good credits
Earned some good credits
Posts: 147
Joined: Tue Dec 06, 2011 5:52 pm
Location: Helsinki

Identifier "wxZipStreamLink" is undefined + unresolved externals

Post by Tapsa »

I am trying to build my app using Visual Studio 14. Before I have built it using GCC.
I have built the adv library of wx (which updates 10 targets), then I have added all of the libs into AdditionalDependencies tag as
wxmsw31ud_adv.lib;wxmsw31ud_core.lib;wxbase31ud.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;wxregexud.lib;wxexpatd.lib
Compilation ends with these errors.
Error (active) identifier "wxZipStreamLink" is undefined Kuvastin c:\Cpp\wxWidgets\include\wx\zipstrm.h 407

Error LNK2001 unresolved external symbols
"void (__cdecl* wxTheAssertHandler)(class wxString const &,int,class wxString const &,class wxString const &,class wxString const &)" (?wxTheAssertHandler@@3P6AXABVwxString@@H000@ZA) Kuvastin C:\Prog\frame.obj 1
"void (__cdecl* wxTheAssertHandler)(class wxString const &,int,class wxString const &,class wxString const &,class wxString const &)" (?wxTheAssertHandler@@3P6AXABVwxString@@H000@ZA) Kuvastin C:\Prog\main.obj 1
"bool wxTrapInAssert" (?wxTrapInAssert@@3_NA) Kuvastin C:\Prog\frame.obj 1
"bool wxTrapInAssert" (?wxTrapInAssert@@3_NA) Kuvastin C:\Prog\main.obj 1
"class wxMBConv * wxConvLibcPtr" (?wxConvLibcPtr@@3PAVwxMBConv@@A) Kuvastin C:\Prog\frame.obj 1
"class wxMBConv * wxConvLibcPtr" (?wxConvLibcPtr@@3PAVwxMBConv@@A) Kuvastin C:\Prog\main.obj 1
"class wxCSConv * wxConvLocalPtr" (?wxConvLocalPtr@@3PAVwxCSConv@@A) Kuvastin C:\Prog\frame.obj 1
"wchar_t const * const wxEmptyString" (?wxEmptyString@@3PB_WB) Kuvastin C:\Prog\frame.obj 1
"wchar_t const * const wxEmptyString" (?wxEmptyString@@3PB_WB) Kuvastin C:\Prog\main.obj 1
"public: static unsigned int const wxString::npos" (?npos@wxString@@2IB) Kuvastin C:\Prog\frame.obj 1
"public: static unsigned int const wxString::npos" (?npos@wxString@@2IB) Kuvastin C:\Prog\main.obj 1
"private: static unsigned long wxThread::ms_idMainThread" (?ms_idMainThread@wxThread@@0KA) Kuvastin C:\Prog\frame.obj 1
"private: static bool wxLog::ms_doLog" (?ms_doLog@wxLog@@0_NA) Kuvastin C:\Prog\frame.obj 1
"char const * const wxPanelNameStr" (?wxPanelNameStr@@3QBDB) Kuvastin C:\Prog\frame.obj 1
"class wxSize const wxDefaultSize" (?wxDefaultSize@@3VwxSize@@B) Kuvastin C:\Prog\frame.obj 1
"class wxPoint const wxDefaultPosition" (?wxDefaultPosition@@3VwxPoint@@B) Kuvastin C:\Prog\frame.obj 1
"class wxDateTime const wxDefaultDateTime" (?wxDefaultDateTime@@3VwxDateTime@@B) Kuvastin C:\Prog\frame.obj 1
"private: static long const wxDateTime::TIME_T_FACTOR" (?TIME_T_FACTOR@wxDateTime@@0JB) Kuvastin C:\Prog\frame.obj 1
"class wxAnyValueType * wxAnyNullValueType" (?wxAnyNullValueType@@3PAVwxAnyValueType@@A) Kuvastin C:\Prog\frame.obj 1
"int const wxEVT_NULL" (?wxEVT_NULL@@3HB) Kuvastin C:\Prog\frame.obj 1
"class wxEventTypeTag<class wxCommandEvent> const wxEVT_LISTBOX" (?wxEVT_LISTBOX@@3V?$wxEventTypeTag@VwxCommandEvent@@@@B) Kuvastin C:\Prog\frame.obj 1
"class wxEventTypeTag<class wxThreadEvent> const wxEVT_THREAD" (?wxEVT_THREAD@@3V?$wxEventTypeTag@VwxThreadEvent@@@@B) Kuvastin C:\Prog\frame.obj 1
"class wxEventTypeTag<class wxMouseEvent> const wxEVT_LEFT_DOWN" (?wxEVT_LEFT_DOWN@@3V?$wxEventTypeTag@VwxMouseEvent@@@@B) Kuvastin C:\Prog\frame.obj 1
"class wxEventTypeTag<class wxMouseEvent> const wxEVT_LEFT_UP" (?wxEVT_LEFT_UP@@3V?$wxEventTypeTag@VwxMouseEvent@@@@B) Kuvastin C:\Prog\frame.obj 1
"class wxEventTypeTag<class wxMouseEvent> const wxEVT_MIDDLE_DOWN" (?wxEVT_MIDDLE_DOWN@@3V?$wxEventTypeTag@VwxMouseEvent@@@@B) Kuvastin C:\Prog\frame.obj 1
"class wxEventTypeTag<class wxMouseEvent> const wxEVT_LEFT_DCLICK" (?wxEVT_LEFT_DCLICK@@3V?$wxEventTypeTag@VwxMouseEvent@@@@B) Kuvastin C:\Prog\frame.obj 1
"class wxEventTypeTag<class wxFocusEvent> const wxEVT_SET_FOCUS" (?wxEVT_SET_FOCUS@@3V?$wxEventTypeTag@VwxFocusEvent@@@@B) Kuvastin C:\Prog\frame.obj 1
"class wxEventTypeTag<class wxChildFocusEvent> const wxEVT_CHILD_FOCUS" (?wxEVT_CHILD_FOCUS@@3V?$wxEventTypeTag@VwxChildFocusEvent@@@@B) Kuvastin C:\Prog\frame.obj 1
"class wxEventTypeTag<class wxNavigationKeyEvent> const wxEVT_NAVIGATION_KEY" (?wxEVT_NAVIGATION_KEY@@3V?$wxEventTypeTag@VwxNavigationKeyEvent@@@@B) Kuvastin C:\Prog\frame.obj 1
"class wxEventTypeTag<class wxKeyEvent> const wxEVT_KEY_DOWN" (?wxEVT_KEY_DOWN@@3V?$wxEventTypeTag@VwxKeyEvent@@@@B) Kuvastin C:\Prog\frame.obj 1
"class wxEventTypeTag<class wxCloseEvent> const wxEVT_CLOSE_WINDOW" (?wxEVT_CLOSE_WINDOW@@3V?$wxEventTypeTag@VwxCloseEvent@@@@B) Kuvastin C:\Prog\frame.obj 1
"class wxEventTypeTag<class wxPaintEvent> const wxEVT_PAINT" (?wxEVT_PAINT@@3V?$wxEventTypeTag@VwxPaintEvent@@@@B) Kuvastin C:\Prog\frame.obj 1
"class wxEventTypeTag<class wxEraseEvent> const wxEVT_ERASE_BACKGROUND" (?wxEVT_ERASE_BACKGROUND@@3V?$wxEventTypeTag@VwxEraseEvent@@@@B) Kuvastin C:\Prog\frame.obj 1
"class wxEventTypeTag<class wxTimerEvent> const wxEVT_TIMER" (?wxEVT_TIMER@@3V?$wxEventTypeTag@VwxTimerEvent@@@@B) Kuvastin C:\Prog\frame.obj 1
"class wxValidator const wxDefaultValidator" (?wxDefaultValidator@@3VwxValidator@@B) Kuvastin C:\Prog\frame.obj 1
"char const * const wxFrameNameStr" (?wxFrameNameStr@@3QBDB) Kuvastin C:\Prog\frame.obj 1
"char const * const wxStatusBarNameStr" (?wxStatusBarNameStr@@3QBDB) Kuvastin C:\Prog\frame.obj 1
"char const * const wxListBoxNameStr" (?wxListBoxNameStr@@3QBDB) Kuvastin C:\Prog\frame.obj 1
"char const * const wxStaticTextNameStr" (?wxStaticTextNameStr@@3QBDB) Kuvastin C:\Prog\frame.obj 1
"char const * const wxTextCtrlNameStr" (?wxTextCtrlNameStr@@3QBDB) Kuvastin C:\Prog\frame.obj 1
"class wxEventTypeTag<class wxCommandEvent> const wxEVT_TEXT_ENTER" (?wxEVT_TEXT_ENTER@@3V?$wxEventTypeTag@VwxCommandEvent@@@@B) Kuvastin C:\Prog\frame.obj 1
"char const * const wxDirDialogNameStr" (?wxDirDialogNameStr@@3QBDB) Kuvastin C:\Prog\frame.obj 1
"char const * const wxDirSelectorPromptStr" (?wxDirSelectorPromptStr@@3QBDB) Kuvastin C:\Prog\frame.obj 1
"public: static class wxClassInfo wxDirDialog::ms_classInfo" (?ms_classInfo@wxDirDialog@@2VwxClassInfo@@A) Kuvastin C:\Prog\frame.obj 1
"char const * const wxGetTextFromUserPromptStr" (?wxGetTextFromUserPromptStr@@3QBDB) Kuvastin C:\Prog\frame.obj 1
"char const * const wxDirPickerWidgetLabel" (?wxDirPickerWidgetLabel@@3QBDB) Kuvastin C:\Prog\frame.obj 1
"char const * const wxDirPickerWidgetNameStr" (?wxDirPickerWidgetNameStr@@3QBDB) Kuvastin C:\Prog\frame.obj 1
"char const * const wxDirPickerCtrlNameStr" (?wxDirPickerCtrlNameStr@@3QBDB) Kuvastin C:\Prog\frame.obj 1
"class wxEventTypeTag<class wxFileDirPickerEvent> const wxEVT_DIRPICKER_CHANGED" (?wxEVT_DIRPICKER_CHANGED@@3V?$wxEventTypeTag@VwxFileDirPickerEvent@@@@B) Kuvastin C:\Prog\frame.obj 1
"protected: static class wxAppConsole * (__cdecl* wxAppConsoleBase::ms_appInitFn)(void)" (?ms_appInitFn@wxAppConsoleBase@@1P6APAVwxAppConsole@@XZA) Kuvastin C:\Prog\main.obj 1
"protected: static class wxAppConsole * wxAppConsoleBase::ms_appInstance" (?ms_appInstance@wxAppConsoleBase@@1PAVwxAppConsole@@A) Kuvastin C:\Prog\main.obj 1

Error LNK1120 46 unresolved externals Kuvastin C:\Prog\Debug\Kuvastin.exe 1
Do these errors ring any bells to you?
catalin
Moderator
Moderator
Posts: 1618
Joined: Wed Nov 12, 2008 7:23 am
Location: Romania

Re: Identifier "wxZipStreamLink" is undefined + unresolved externals

Post by catalin »

Are you getting these with wxW samples or something else?
Tapsa wrote:I have built the adv library of wx
Why only adv library? Maybe you need to build all libs (I'd even go as far as advising you to do a clean build). wxZipStreamLink for example should be in base library.
Tapsa wrote:then I have added all of the libs into AdditionalDependencies tag
Why would you need to add the libs anywhere? wxW provides vc14 build files.
Tapsa
Earned some good credits
Earned some good credits
Posts: 147
Joined: Tue Dec 06, 2011 5:52 pm
Location: Helsinki

Re: Identifier "wxZipStreamLink" is undefined + unresolved externals

Post by Tapsa »

Are you getting these with wxW samples or something else?
I get a lot of errors with even minimal sample. (setup header is still not properly included in sample project files.) This is my own application that compiles fine with GCC. I want to compile it with Visual Studio too.
Why only adv library?
I did in fact build base, core and adv. I just noticed that building adv builds the others (that I should need) anyway.
wxZipStreamLink indeed should be in the base library.
Why would you need to add the libs anywhere?
Erm. Because its my own application?
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4204
Joined: Sun Jan 03, 2010 5:45 pm

Re: Identifier "wxZipStreamLink" is undefined + unresolved externals

Post by PB »

Tapsa wrote:I get a lot of errors with even minimal sample. (setup header is still not properly included in sample project files.)
If you cannot even build the provided minimal sample, it seems obvious that you did not build wxWidgets properly. I would start there.
Tapsa
Earned some good credits
Earned some good credits
Posts: 147
Joined: Tue Dec 06, 2011 5:52 pm
Location: Helsinki

Re: Identifier "wxZipStreamLink" is undefined + unresolved externals

Post by Tapsa »

I cannot build minimal sample with GCC either, yet I can compile my wx applications fine with GCC using CMake.

Code: Select all

mingw32-make -f makefile.gcc
results in
fatal error: wx/setup.h: No such file or directory
If I add include folder for setup header it still fails

Code: Select all

mingw32-make -f makefile.gcc -I C:\Cpp\wxWidgets\lib\gcc_dll\mswud
I can't copy and place the setup header in wxWidgets\include\wx because I am using two different compilers, can I?
So how to fix the setup header problem for 2 compilers?
Adding "C:\Cpp\wxWidgets\lib\mswud" to additional include directories doesn't help MSVC build.

Better yet, what command line you suggest to me for building wxWidgets with GCC?
I have used

Code: Select all

mingw32-make -f makefile.gcc BUILD=debug SHARED=1 USE_AUI=0 USE_PROPGRID=0 USE_RIBBON=0 USE_STC=0 USE_WEBVIEW=0 USE_RICHTEXT=0 USE_XML=0
When I only need adv, core and base for my applications.

For MSVC build I opened the \wxWidgets\build\msw\wx_vc14.sln and chose DLL debug then hit build on adv (+core & base).
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4204
Joined: Sun Jan 03, 2010 5:45 pm

Re: Identifier "wxZipStreamLink" is undefined + unresolved externals

Post by PB »

As catalyn said, be sure to start with a clean build, i.e., no remains of previous builds either in WXWIN\vc_* and WXWIN\gcc_* as well in WXWIN\build\msw\vc_* and WXWIN\build\msw\gcc_*. In fact, if I were you, I would make sure the whole wxWidgets folder is pristine.

Then I would go to build\msw and attempted to do the default build, i.e. something like
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
cd %WXWIN%\build\MSW
nmake -f makefile.vc BUILD=debug SHARED=1
Once this builds successfully, repeat the same procedure for the minimal sample. After verifying I can actually properly build wxWidgets in its default configuration, I would start customizing the build. As MSVC can build wxWidgets rather fast even with the makefile (unlike MinGW), it should not take much time...

I do not know which wxWidgets version are you using, I remember something about 3.0x not supporting MSVC15, but building wxWidgets with MSVC should work out of the box.
Tapsa
Earned some good credits
Earned some good credits
Posts: 147
Joined: Tue Dec 06, 2011 5:52 pm
Location: Helsinki

Re: Identifier "wxZipStreamLink" is undefined + unresolved externals

Post by Tapsa »

Same problem still happens. I deleted wxWidgets folder, unpacked it all again from 3.1.0 7z file. Then I ran in wxWidgets\build\msw command

Code: Select all

mingw32-make -f makefile.gcc BUILD=debug SHARED=1
Building minimal sample with

Code: Select all

mingw32-make -f makefile.gcc
fails to
.\..\..\include/wx/platform.h:136:22: fatal error: wx/setup.h: No such file or directory
#include "wx/setup.h"
catalin
Moderator
Moderator
Posts: 1618
Joined: Wed Nov 12, 2008 7:23 am
Location: Romania

Re: Identifier "wxZipStreamLink" is undefined + unresolved externals

Post by catalin »

Of course it does. wxW build command contains "SHARED=1", while the one for minimal sample does not.
Use the exact same options (thus command) for building the libs and the apps.

p.s. not specified options take the default value, see config.gcc in your case, and for "SHARED" it happens to be 0.
Tapsa
Earned some good credits
Earned some good credits
Posts: 147
Joined: Tue Dec 06, 2011 5:52 pm
Location: Helsinki

Re: Identifier "wxZipStreamLink" is undefined + unresolved externals

Post by Tapsa »

xP I didn't know that... now same with Visual Studio, how do I do the default build?

And, how do I build only adv, core and base libs of wxWidgets? Those USE_AUI=0 etc can only ditch half of the libs, but still several useless to me libs are built.
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Identifier "wxZipStreamLink" is undefined + unresolved externals

Post by doublemax »

Why would you want to build only a few libs? Just build the whole project.
Use the source, Luke!
Tapsa
Earned some good credits
Earned some good credits
Posts: 147
Joined: Tue Dec 06, 2011 5:52 pm
Location: Helsinki

Re: Identifier "wxZipStreamLink" is undefined + unresolved externals

Post by Tapsa »

To conserve space on my little SSD.

Anyway, now realizing that build config needs to be identical, I finally succeeded in building minimal sample as DLL Debug.

EDIT: I can't mark this topic as solved, because I only managed to build and run minimal sample. My own project still has loads of errors and wxFrame is "incomplete type" even after I copied all kinds of settings from minimal sample vcproj file.

I'm giving up on Visual Studio, because it is too hard to come up with working vcproj file.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4204
Joined: Sun Jan 03, 2010 5:45 pm

Re: Identifier "wxZipStreamLink" is undefined + unresolved externals

Post by PB »

Tapsa wrote:I'm giving up on Visual Studio, because it is too hard to come up with working vcproj file.
Actually, if you follow the instructions in install.txt, creating a MSVC wxWidgets project with two configurations (debug and release) takes less then 5 minutes when starting from a scratch (empty project generated by MSVC).
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Identifier "wxZipStreamLink" is undefined + unresolved externals

Post by doublemax »

Actually, if you follow the instructions in install.txt, creating a MSVC wxWidgets project with two configurations (debug and release) takes less then 5 minutes when starting from a scratch (empty project generated by MSVC).
I think it's even easier to just copy the "minimal" sample and adjust the paths (3 for each configuration).
Use the source, Luke!
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4204
Joined: Sun Jan 03, 2010 5:45 pm

Re: Identifier "wxZipStreamLink" is undefined + unresolved externals

Post by PB »

I created a simple MSVC 14 project, linking wxWidgets dynamically (Win32 only, X64 configurations are easy to add). Please note that it uses the "trick" with MSVC autolinking the required wxWidgets libraries (see the end of WXWIN\docs\mswinstall.txt), so there are no libraries manually added there and it keeps working even when the libraries name change (e.g. a different version).

The project also has support for the custom resource file as well as precompiled headers.

It requires the WXWIN environment variable set properly to wxWidgets folder.

The project can be easily switched to linking to wxWidgets statically, all what is needed is to remove WXUSINGDLL from the preprocessor defines in all required build configurations.
Empty MSVC14 DLL project.zip
(7.61 KiB) Downloaded 104 times
Tapsa
Earned some good credits
Earned some good credits
Posts: 147
Joined: Tue Dec 06, 2011 5:52 pm
Location: Helsinki

Re: Identifier "wxZipStreamLink" is undefined + unresolved externals

Post by Tapsa »

Thanks for the project, but it doesn't compile. I added WXWIN=C:\Cpp\wxWidgets to system variables.
Immediately upon opening PBApp.sln these errors are shown:
Error (active) cannot open source file "wx/wx.h" PBApp DLL c:\Users\Tapsa\Downloads\Empty MSVC14 DLL project\Precompiled.h 14
Error (active) cannot open source file "wx/wx.h" PBApp DLL c:\Users\Tapsa\Downloads\Empty MSVC14 DLL project\MainWindow.h 5
Error (active) not a class or struct name PBApp DLL c:\Users\Tapsa\Downloads\Empty MSVC14 DLL project\MainWindow.h 7
I have only built DLL Debug/Release of wxWidgets with Visual Studio by the way.
Post Reply