Re: dll linking problem

Jeroen van der Zijp <[email protected]> Fri, 31 Jan 2025 17:21:41 -0600
Newsgroups gmane.comp.lib.fox-toolkit.user
Organization FOX Toolkit
Message-ID <[email protected]>
On Fri, 31 Jan 2025 19:01:06 +0000
levan shoshiashvili <[email protected]> wrote:

> Hello Jeroen
> System windows 10 64bit;
> VS2022;
> Static lib compiles and links fine.
> For dll I got those errors:
> 
> 1>imageviewer.cpp
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXXML.h(104,25): warning C4251: 'FX::FXXML::startDocumentCB': class 'FX::FXCallback<FX::FXXML::Error (void)>' needs to have dll-interface to be used by clients of class 'FX::FXXML'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXXML.h(104,3): message : see declaration of 'FX::FXCallback<FX::FXXML::Error (void)>'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXXML.h(107,66): warning C4251: 'FX::FXXML::startElementCB': class 'FX::FXCallback<FX::FXXML::Error (const FX::FXString &,const FX::FXStringDictionary &)>' needs to have dll-interface to be used by clients of class 'FX::FXXML'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXXML.h(107,3): message : see declaration of 'FX::FXCallback<FX::FXXML::Error (const FX::FXString &,const FX::FXStringDictionary &)>'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXXML.h(110,40): warning C4251: 'FX::FXXML::charactersCB': class 'FX::FXCallback<FX::FXXML::Error (const FX::FXString &)>' needs to have dll-interface to be used by clients of class 'FX::FXXML'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXXML.h(110,3): message : see declaration of 'FX::FXCallback<FX::FXXML::Error (const FX::FXString &)>'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXXML.h(113,40): warning C4251: 'FX::FXXML::commentCB': class 'FX::FXCallback<FX::FXXML::Error (const FX::FXString &)>' needs to have dll-interface to be used by clients of class 'FX::FXXML'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXXML.h(110,3): message : see declaration of 'FX::FXCallback<FX::FXXML::Error (const FX::FXString &)>'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXXML.h(116,56): warning C4251: 'FX::FXXML::processingCB': class 'FX::FXCallback<FX::FXXML::Error (const FX::FXString &,const FX::FXString &)>' needs to have dll-interface to be used by clients of class 'FX::FXXML'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXXML.h(116,3): message : see declaration of 'FX::FXCallback<FX::FXXML::Error (const FX::FXString &,const FX::FXString &)>'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXXML.h(119,40): warning C4251: 'FX::FXXML::endElementCB': class 'FX::FXCallback<FX::FXXML::Error (const FX::FXString &)>' needs to have dll-interface to be used by clients of class 'FX::FXXML'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXXML.h(110,3): message : see declaration of 'FX::FXCallback<FX::FXXML::Error (const FX::FXString &)>'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXXML.h(122,25): warning C4251: 'FX::FXXML::endDocumentCB': class 'FX::FXCallback<FX::FXXML::Error (void)>' needs to have dll-interface to be used by clients of class 'FX::FXXML'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXXML.h(104,3): message : see declaration of 'FX::FXCallback<FX::FXXML::Error (void)>'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXThreadPool.h(70,19): warning C4251: 'FX::FXThreadPool::queue': class 'FX::FXLFQueueOf<FX::FXRunnable>' needs to have dll-interface to be used by clients of class 'FX::FXThreadPool'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXThreadPool.h(34,9): message : see declaration of 'FX::FXLFQueueOf<FX::FXRunnable>'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXIconCache.h(58,21): warning C4251: 'FX::FXIconCache::dict': class 'FX::FXDictionaryOf<FX::FXIcon>' needs to have dll-interface to be used by clients of class 'FX::FXIconCache'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXIconCache.h(37,9): message : see declaration of 'FX::FXDictionaryOf<FX::FXIcon>'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXFileAssociations.h(104,26): warning C4251: 'FX::FXFileAssociations::bindings': class 'FX::FXDictionaryOf<FX::FXFileAssoc>' needs to have dll-interface to be used by clients of class 'FX::FXFileAssociations'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXFileAssociations.h(50,9): message : see declaration of 'FX::FXDictionaryOf<FX::FXFileAssoc>'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXList.h(172,18): warning C4251: 'FX::FXList::items': class 'FX::FXObjectListOf<FX::FXListItem>' needs to have dll-interface to be used by clients of class 'FX::FXList'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXList.h(153,9): message : see declaration of 'FX::FXObjectListOf<FX::FXListItem>'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXHeader.h(201,20): warning C4251: 'FX::FXHeader::items': class 'FX::FXObjectListOf<FX::FXHeaderItem>' needs to have dll-interface to be used by clients of class 'FX::FXHeader'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXHeader.h(176,9): message : see declaration of 'FX::FXObjectListOf<FX::FXHeaderItem>'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXIconList.h(204,22): warning C4251: 'FX::FXIconList::items': class 'FX::FXObjectListOf<FX::FXIconItem>' needs to have dll-interface to be used by clients of class 'FX::FXIconList'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXIconList.h(172,9): message : see declaration of 'FX::FXObjectListOf<FX::FXIconItem>'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXUndoList.h(158,19): warning C4251: 'FX::FXCommandGroup::command': class 'FX::FXArray<FX::FXCommandPtr>' needs to have dll-interface to be used by clients of class 'FX::FXCommandGroup'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXUndoList.h(133,9): message : see declaration of 'FX::FXArray<FX::FXCommandPtr>'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXConsole.h(56,18): warning C4251: 'FX::FXConsole::contents': class 'FX::FXArray<FX::FXString>' needs to have dll-interface to be used by clients of class 'FX::FXConsole'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXConsole.h(45,9): message : see declaration of 'FX::FXArray<FX::FXString>'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXConsole.h(57,18): warning C4251: 'FX::FXConsole::style': class 'FX::FXArray<FX::FXString>' needs to have dll-interface to be used by clients of class 'FX::FXConsole'
> 1>F:\Users\LAE\levan\work\fox-1.7.85\include\FXConsole.h(45,9): message : see declaration of 'FX::FXArray<FX::FXString>'
> 1>   Creating library F:\Users\LAE\levan\work\fox-1.7.85\windows\x64\Release\ImageViewer.lib and object F:\Users\LAE\levan\work\fox-1.7.85\windows\x64\Release\ImageViewer.exp
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "public: static class FX::FXMetaClass const FX::FXMainWindow::metaClass" (?metaClass@FXMainWindow@FX@@2VFXMetaClass@2@B)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "private: static unsigned short const * const FX::FXhalf::fhb" (?fhb@FXhalf@FX@@0QBGB)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "private: static unsigned char const * const FX::FXhalf::fhs" (?fhs@FXhalf@FX@@0QBEB)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "private: static unsigned int const * const FX::FXhalf::hfm" (?hfm@FXhalf@FX@@0QBIB)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "private: static unsigned int const * const FX::FXhalf::hfe" (?hfe@FXhalf@FX@@0QBIB)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "private: static unsigned short const * const FX::FXhalf::hfw" (?hfw@FXhalf@FX@@0QBGB)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "public: static char const * const FX::FXException::exceptionName" (?exceptionName@FXException@FX@@2QBDB)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "public: static char const * const FX::FXFatalException::exceptionName" (?exceptionName@FXFatalException@FX@@2QBDB)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "public: static char const * const FX::FXErrorException::exceptionName" (?exceptionName@FXErrorException@FX@@2QBDB)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "public: static char const * const FX::FXRangeException::exceptionName" (?exceptionName@FXRangeException@FX@@2QBDB)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "public: static char const * const FX::FXPointerException::exceptionName" (?exceptionName@FXPointerException@FX@@2QBDB)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "public: static char const * const FX::FXResourceException::exceptionName" (?exceptionName@FXResourceException@FX@@2QBDB)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "public: static char const * const FX::FXMemoryException::exceptionName" (?exceptionName@FXMemoryException@FX@@2QBDB)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "public: static char const * const FX::FXWindowException::exceptionName" (?exceptionName@FXWindowException@FX@@2QBDB)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "public: static char const * const FX::FXImageException::exceptionName" (?exceptionName@FXImageException@FX@@2QBDB)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "public: static char const * const FX::FXFontException::exceptionName" (?exceptionName@FXFontException@FX@@2QBDB)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "public: static char const * const FX::FXThreadException::exceptionName" (?exceptionName@FXThreadException@FX@@2QBDB)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "public: static char const * const FX::FXString::null" (?null@FXString@FX@@2QBDB)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "private: static char const (* FX::FXDate::shortMonthName)[4]" (?shortMonthName@FXDate@FX@@0QAY03$$CBDA)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "private: static char const (* FX::FXDate::longMonthName)[10]" (?longMonthName@FXDate@FX@@0QAY09$$CBDA)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "private: static char const (* FX::FXDate::shortWeekDay)[4]" (?shortWeekDay@FXDate@FX@@0QAY03$$CBDA)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "private: static char const (* FX::FXDate::longWeekDay)[10]" (?longWeekDay@FXDate@FX@@0QAY09$$CBDA)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "protected: static char const * const * const FX::FXJSON::errors" (?errors@FXJSON@FX@@1QBQEBDB)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "private: static char const * const * const FX::FXINI::errors" (?errors@FXINI@FX@@0QBQEBDB)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "private: static char const * const * const FX::FXXML::errors" (?errors@FXXML@FX@@0QBQEBDB)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "private: static class FX::FXApp * FX::FXApp::app" (?app@FXApp@FX@@0PEAV12@EA)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "private: static char const * const * const FX::FXRex::errors" (?errors@FXRex@FX@@0QBQEBDB)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "private: static unsigned char const * const FX::FXExpression::initial" (?initial@FXExpression@FX@@0QBEB)
> 1>imageviewer.obj : error LNK2001: unresolved external symbol "private: static char const * const * const FX::FXExpression::errors" (?errors@FXExpression@FX@@0QBQEBDB)
> 1>F:\Users\LAE\levan\work\fox-1.7.85\windows\x64\Release\ImageViewer.exe : fatal error LNK1120: 29 unresolved externals  
> 
> Yes I have set -DFOXDLL in imageviewer project options.

You might need -DFOX_DLL -DFOXDLL_EXPORTS when *compiling* the library, and
just -DFOX_DLL when *using* the library.


FYI, project files for VC++ were missing some files; new snapshot cover this.


    -- JVZ