problem compiling fromDll with 2.6.3 under WinXP & MSVC6 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
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

problem compiling fromDll with 2.6.3 under WinXP & MSVC6

Post by Widgets »

I'm trying to compile the updated fromDLL example from

www.dastur.me.uk/wx/wxDLL_VS7-1_ReallyWorks.zip

using MSVC 6.00

I've added the include paths and WXUSINGDLL to the fromDll project, but when I try to link that portion, I get the linker complaining:

LINK : fatal error LNK1104: cannot open file: "wxmsw26d_qa.lib"

and indeed I cannot find the file.

I've tried to make it with
nmake -f makefile.vcc SHARED=1 MONOLITHIC=1 BUILD=debug USE_QA=1
but nothing seems to happen and the library doesn't get built.

What am I missing or overlooking?
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Post by Widgets »

After posting and thinking some more, I realized I should not use MONOLITHIC=1, but even without that, the library I seem to need does not get built.
Dandel1984
Knows some wx things
Knows some wx things
Posts: 40
Joined: Wed Jun 01, 2005 3:52 am

Post by Dandel1984 »

i would look at your files after reading this...

http://www.wxwindows.org/manuals/2.6.3/ ... slist.html

look at your wxwidgets directory where you find wxbase26 and find the file that has QA on it, because there should be no reason for it to exist, but it might be under a different name than your using.
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Post by Widgets »

Again, thanks.
I had a look at the link and have also tried to compile this under MSVC6.0 as a release, figuring that the QA lib should not be needed - since it supposedly only contains wxDebugReport, but surprise, surprise, it now complains about wxmsw26_qa.lib not being found.

As you might have guessed it is all part of the same search for a solution to using wxwidgets from a dll.
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Post by Widgets »

OK, I've resolved that issue.

By looking at the makefile.vc I've found that I need to use
nmake -f makefile.vc SHARED=1 USE_GUI=1 USE_QA=1

Now at least the libs etc are made, but now I get other errors - unresolved externals. I'll investigate that part and see how far I get.
Environment: Win 10/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Post by Widgets »

Getting closer and closer

I had assumed WXUSINGDLL needed to be defined only for the main app.

As a trial I defined it also for the dll and lo and behold the DEBUG version actually compiles without errors and once I make all of the necessary wxWidget dlls accessible ot the application, it runs and does its thing.

The RELEASE version still has an undefined symbol:

FromDLL.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall wxStringData::Free(void)" (__imp_?Free@wxStringData@@QAEXXZ)

According to a comment in string.cpp the code for this function is omitted in certain cases when compiling under Visual C++ - but no info re possible timeframe for or means of resolution :-(

Anyone with any suggestions?
Environment: Win 10/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
dsilvia
Earned some good credits
Earned some good credits
Posts: 145
Joined: Sun May 29, 2005 3:42 pm
Location: Bettendorf, Iowa, USA (aka, BFE)

Post by dsilvia »

As per C:\wxWidgets-2.6.3\src\common\string.cpp

Code: Select all


// ===========================================================================
// wxStringData class deallocation
// ===========================================================================

#if defined(__VISUALC__) && defined(_MT) && !defined(_DLL)
#  pragma message (__FILE__ ": building with Multithreaded non DLL runtime has a performance impact on wxString!")
void wxStringData::Free()
{
    free(this);
}
#endif

Which means that your wxWidgets libraries in vc_lib and your current code you're working with in Visual Studio 2005 must be in synch. If one qualifies to have the subject member function defined and included, so must the other, and the converse is true.

I had built my vc_lib using DialogBlocks which defaults to DLLs, so, the above code was never compiled into my wxWidgets libraries for vc_lib. Now, I went to Visual Studio 2005 Express to build some existing code and it defaulted to /MT. This meant that the above code was compiled into my application, so up popped the unresolved references. On changing to /MD everything was hunkey-dorey! :D


HTH,
Dave S.
Post Reply