[
Lit Window Library at SourceForge
] [
Lit Window Productions Homepage
] [
wxWidgets Tips&Tricks ]
[
wxVisualSetup ]
Data Adapter Compiler & Linker Warnings and Errors
The Data Adapter mechanism relies heavily on templates. Some mistakes generate rather obscure error messages and warnings. This section helps you solve these problems. The message numbers here refer to the Microsoft Visual C++ compiler.
VC++ 6.0, Debug Build and using get/set methods PROP_GetSet/PROP_RW_FUNC etc... The VC 6.0 compiler is broken in many places, especially when it comes to templates. It duplicates the template instantiation make_getter_setter<...> when it should not.
Change the build settings for the offending object file. Goto 'xyz.cpp' and make the following changes for the debug build: On the C++ tab in the 'General' category set 'Debug info' to 'Program Database' instead of 'Program Database for Edit and Continue'. In the 'Optimizations' category set 'Inline function expansion' to 'only __inline' instead of 'Disable'. This causes the offending template to be inlined and the error will disappear.
You are using DECLARE_ADAPTER_TYPE(type, importexportspec) in an include file, using IMPLEMENT_ADAPTER_TYPE(type) in a source file and the 'importexportspec' is defined as "_declspec(dllimport)".
IMPLEMENT_ADAPTER_TYPE(type) will always export _declspec(dllexport) the code that is being generated. Verify that the import/export specification you pass to DECLARE_ADAPTER_TYPE is correctly defined and resolves to _declspec(dllexport) when compiling the DLL/EXE.
You are using VC 6.0, DECLARE_ADAPTER_TYPE(type, importexportspec) in an include file, using IMPLEMENT_ADAPTER_TYPE(type) in one source file and BEGIN_ADAPTER/END_ADAPTER in another source file. importexportspec is correctly defined.
DECLARE_ADAPTER_TYPE declares an explicit specialization of a static function of a template class. data_adapter.h declares the generic template with _declspec(dllimport). The compiler will quietly change this to _declspec(dllexport) when it sees IMPLEMENT_ADAPTER_TYPE. But if you are using BEGIN_ADAPTER/END_ADAPTER in a different source file, that source file does not see the IMPLEMENT_ADAPTER_TYPE definition and thus the compiler assumes _declspec(dllimport) here.
This warning can safely be ignored. Pass "/WARN:1" to the linker to suppress this and all other warnings of level 2 and above. Future versions of the Lit Window Library may find a way to solve this problem.
Copyright 2004,
Hajo Kirchhoff, Lit Window Productions