Opened 4 years ago

Closed 4 years ago

#11966 closed defect (fixed)

Link warnings with wxScintilla libary

Reported by: SnowLeopard Owned by:
Priority: normal Milestone: 3.0.0
Component: wxStyledText Version: stable-latest
Keywords: Cc:
Blocked By: Blocking:
Patch: no

Description

Windows XP SP2
Visual Studio 2005

With the 04/20/2010 snapshot, when I build the "STC" sample (Debug) I get these link warnings:

wxscintillad.lib(ScintillaBase.obj) : warning LNK4217: locally defined symbol ??1wxString@@QAE@XZ (public: __thiscall wxString::~wxString(void)) imported in function "public: void * __thiscall wxString::`vector deleting destructor'(unsigned int)" (??_EwxString@@QAEPAXI@Z)
wxscintillad.lib(Editor.obj) : warning LNK4217: locally defined symbol ??1wxString@@QAE@XZ (public: __thiscall wxString::~wxString(void)) imported in function "char const * __cdecl ControlCharacterString(unsigned char)" (?ControlCharacterString@@YAPBDE@Z)
wxscintillad.lib(Selection.obj) : warning LNK4049: locally defined symbol ??1wxString@@QAE@XZ (public: __thiscall wxString::~wxString(void)) imported
wxscintillad.lib(PositionCache.obj) : warning LNK4049: locally defined symbol ??1wxString@@QAE@XZ (public: __thiscall wxString::~wxString(void)) imported
wxscintillad.lib(Editor.obj) : warning LNK4217: locally defined symbol ?wxOnAssert@@YAXPBDH000@Z (void __cdecl wxOnAssert(char const *,int,char const *,char const *,char const *)) imported in function "public: struct SelectionRange & __thiscall wxVector<struct SelectionRange>::at(unsigned int)" (?at@?$wxVector@USelectionRange@@@@QAEAAUSelectionRange@@I@Z)
wxscintillad.lib(Selection.obj) : warning LNK4049: locally defined symbol ?wxOnAssert@@YAXPBDH000@Z (void __cdecl wxOnAssert(char const *,int,char const *,char const *,char const *)) imported
wxscintillad.lib(Editor.obj) : warning LNK4049: locally defined symbol ?wxTheAssertHandler@@3P6AXABVwxString@@H000@ZA (void (__cdecl* wxTheAssertHandler)(class wxString const &,int,class wxString const &,class wxString const &,class wxString const &)) imported
wxscintillad.lib(Selection.obj) : warning LNK4049: locally defined symbol ?wxTheAssertHandler@@3P6AXABVwxString@@H000@ZA (void (__cdecl* wxTheAssertHandler)(class wxString const &,int,class wxString const &,class wxString const &,class wxString const &)) imported
wxscintillad.lib(Editor.obj) : warning LNK4217: locally defined symbol ?wxQsort@@YAXQAXIIP6AHPBX11@Z1@Z (void __cdecl wxQsort(void * const,unsigned int,unsigned int,int (__cdecl*)(void const *,void const *,void const *),void const *)) imported in function "void __cdecl wxVectorSort<struct SelectionRange>(class wxVector<struct SelectionRange> &)" (??$wxVectorSort@USelectionRange@@@@YAXAAV?$wxVector@USelectionRange@@@@@Z)

I get these warnings from my project which uses wxScintilla too. I was using a 2.9 snapshot from a couple months ago and never got these before, must be something recently changed.

Change History (7)

comment:1 Changed 4 years ago by robind

  • Status changed from new to infoneeded_new

A new version of Scintilla has been merged, and a few modifications have been made to have it use wxVector. I saw some errors like this when I was working on it, but they went away after I ensured that I was doing a clean rebuild. Please make sure that there are no files left over from a prior build and try again.

comment:2 Changed 4 years ago by SnowLeopard

  • Status changed from infoneeded_new to new

Yes, I was sure to do "clean solution" and then "rebuild solution". Actually, I had deleted my old wxWidgets folder when replacing it with the snapshot, so there was nothing to clean.

comment:3 Changed 4 years ago by pjc

I too get these warnings when building an application which uses wxSTC.
Compiler: Visual Studio 2008 on Vista x64 (compiling 32-bit code though).
wxWidgets version: SVN trunk, static library debug build.

comment:4 Changed 4 years ago by pjc

I think that these warnings are caused by the MSVC wxscintilla project file having the wrong preprocessor definitions. Specifically, said project file has WXUSINGDLL defined in the static library (debug and release) build and does not have WXBUILDING defined.
Because src\stc\scintilla\src\Selection.h has the line #include "wx/vector.h", getting the preprocessor definitions correct is important. If I manually remove WXUSINGDLL from the preprocessor definition list and put WXBUILDING it its place, then the warnings disappear. Tracking down the appropriate bakefile changes may be harder.

comment:5 Changed 4 years ago by vadz

  • Milestone set to 3.0
  • Status changed from new to confirmed

Indeed, there is an unconditional <define>WXUSINGDLL</define> in build/bakefiles/scintilla.bkl for some reason while usually we have it inside something like <if cond="SHARED=='1' and MONOLITHIC=='0'"/>. It was added by Robin in r63905 so I hope he remembers why this was done and correct it, I really don't know this code at all unfortunately.

TIA!

comment:6 Changed 4 years ago by vadz

Ok, I looked at this again and I don't think it makes sense to define WXBUILDING when building wxscintilla project, it's a static library and doesn't need to export anything. OTOH WXUSINGDLL should be only defined in DLL configurations and I'll modify the bakefile to do it. Please reopen the bug if this didn't fix the problem. For some reason I don't see the warnings with VC9.

comment:7 Changed 4 years ago by VZ

  • Resolution set to fixed
  • Status changed from confirmed to closed

(In [65090]) Only define WXUSINGDLL in DLL configurations when building wxscintilla.

WXUSINGDLL shouldn't be defined in static build configurations, this results
in warnings and might explain errors in MinGW build.

Closes #11966.

Note: See TracTickets for help on using tickets.