Visual Studio Community 2015: Linker errors and first questions

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
widgetsfox
Earned a small fee
Earned a small fee
Posts: 13
Joined: Wed Sep 14, 2016 9:33 pm

Visual Studio Community 2015: Linker errors and first questions

Post by widgetsfox »

Hello,

I'm just starting to work with Visual Studio Community 2015 and wxWidgets (Windows 7).
First I downloaded and extracted:
1. wxWidgets-3.1.0-headers
2. wxMSW-3.1.0_vc140_Dev

My folder is MY_DRIVE:\MY_PATH\wxWidgets-3.1.0.
I copied the content of wxWidgets-3.1.0-headers to the above folder:
MY_DRIVE:\MY_PATH\wxWidgets-3.1.0\include.
Ditto with content wxMSW-3.1.0_vc140_Dev BUT due to some error messages I renamed the original subfolder \lib\vc140_dll to \lib\vc_lib (is that mentioned somewhere?!):
MY_DRIVE:\MY_PATH\wxWidgets-3.1.0\lib.

The name of my project is Test1a. Then I added the following pathes to the project properties (Debug -> Test1a Properties):

Code: Select all

VC++ Directories
  Include Directories
    MY_DRIVE:\MY_PATH\wxWidgets-3.1.0\include\msvc
    MY_DRIVE:\MY_PATH\wxWidgets-3.1.0\include
  Library Directories
    MY_DRIVE:\MY_PATH\wxWidgets-3.1.0\lib\vc_lib
    Additionally I tried: 
    MY_DRIVE:\MY_PATH\wxWidgets-3.1.0\lib\vc_lib\mswud\wx
That's my code, really nothing fancy:

Code: Select all

#include <wx/wx.h>

class wxStart__Test : public wxApp
{
public:
  bool OnInit()
  {
    wxFrame* window = new wxFrame(NULL, -1, "Hello World!");
    window->Show();
    return true;
  }
};

IMPLEMENT_APP(wxStart__Test);
During linking (Debug -> Start Without Compiling) I got some error messages all related to the code above (Test1a):

Code: Select all

Error LNK1120 7 unresolved externals
Error LNK2001 unresolved external symbol
  "char const * const wxFrameNameStr" (...)
  "class wxMBConv * wxConvLibcPtr" (...)
  "class wxPoint const wxDefaultPosition" (...)
  "class wxSize const wxDefaultSize" (...)
  "protected: static class wxAppConsole * (__cdecl* wxAppConsoleBase::ms_appInitFn)
                                                             (void)" (...)
  "protected: static class wxAppConsole * wxAppConsoleBase::ms_appInstance" (...)
  "public: static unsigned int const wxString::npos" (...)
Must I add *.lib files somewhere - when yes, which? Any Preprocessor settings?

As second try I compiled the sources. Same error messages.


Two additional questions:
  1. Just using the DLLs - what must I do?
  2. Wouldn't it be easier for a beginner to use monolithic builds? So corresponding configurations would be highly appreciated!

Many thanks and greetings
widgetsfox
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Visual Studio Community 2015: Linker errors and first questions

Post by doublemax »

Forget about the precompiled binaries, they cause more problems than they solve. Building the whole libraries yourself is very easy with VS and guarantees that your libraries and header files are in sync.

Here's a description for VS2010:
viewtopic.php?p=142017#p142017

For VS2015 just use wx_vc14.sln where it says wx_vc10.sln. Everything else should be the same.
Use the source, Luke!
onionman
Knows some wx things
Knows some wx things
Posts: 34
Joined: Wed May 20, 2009 7:03 pm

Re: Visual Studio Community 2015: Linker errors and first questions

Post by onionman »

Have an upvote! Thank you for that information!!
widgetsfox
Earned a small fee
Earned a small fee
Posts: 13
Joined: Wed Sep 14, 2016 9:33 pm

Re: Visual Studio Community 2015: Linker errors and first questions

Post by widgetsfox »

Hello doublemax,

many thanks for that info, especially the hint concerning the "minimal_vc14.sln" sample in <wxdir>/samples/minimal/.

I was able to get that sample running.


Many thanks and greetings
widgetsfox
Post Reply