[vtkusers] inconsistent dll linkage

David Cole david.cole at kitware.com
Fri Sep 23 12:09:07 EDT 2005


I'm gonna guess that your class declaration in your header file looks 
like this:
class VTK_RENDERING_EXPORT ObjectInteractorStyle : public vtkInteractorStyle

The problem is that VTK_RENDERING_EXPORT only works for classes that are 
built into vtkRendering.dll. (This is controlled by the definition of 
vtkRendering_EXPORTS.)

You need to define your own similar macro that resolves to 
__declspec(dllexport) when being built into your dll, 
__declspec(dllimport) when being consumed by a client outside your dll 
and nothing when built on a non-Windows system or when built with static 
lib linkage.

You can use a similar technique to that found in Common/vtkWin32Header.h 
using your own lib name in place of vtkRendering. i.e., if your lib is 
named MyLib, you'd test for MyLib_EXPORTS which is defined automatically 
for you by CMake when building your library as shared on Windows.


Hope this helps,
David

Leonardo Soto M. wrote:

> Dear VTKusers,
>
>
>
> I'm trying to implement my own interaction style by extending 
> vtkInteractorStyle, but I'm getting "inconsistent dll linkage". I'm 
> working under the following configuration:
>
>
>
> - MS Visual Studio 7
>
> - I'm developing a dll
>
> - CMAKE  Build_Shared Libraries  = On
>
> - vtk 5 (September 23, 2005)
>
>
>
> I don't understand what is going on, because I did a similar thing 
> under Linux and it worked.
>
>
>
> I would appreciate any help or comments.
>
>
>
> Leonardo Soto
>
> University of Concepcion
>
>
>
>
>
>
> Visual Build Dump:
>
>
> objectInteractorStyle.cpp
> objectInteractorStyle.cpp(6) : warning C4273: 
> ObjectInteractorStyle::CollectRevisions' : inconsistent dll linkage
> objectInteractorStyle.cpp(7) : error C2509: 'New' : member function 
> not declared in 'ObjectInteractorStyle'
> ... see declaration of ObjectInteractorStyle'
> objectInteractorStyle.cpp(10) : error C2511: 
> 'ObjectInteractorStyle::ObjectInteractorStyle(void)' : overloaded 
> member function not found in 'ObjectInteractorStyle'
> ... see declaration of 'ObjectInteractorStyle'
> objectInteractorStyle.cpp(14) : warning C4273: 
> 'ObjectInteractorStyle::~ObjectInteractorStyle' : inconsistent dll 
> linkage
> objectInteractorStyle.cpp(18) : warning C4273: 
> 'ObjectInteractorStyle::OnMouseMove' : inconsistent dll linkage
> objectInteractorStyle.cpp(22) : warning C4273: 
> 'ObjectInteractorStyle::OnLeftButtonDown' : inconsistent dll linkage
> objectInteractorStyle.cpp(26) : warning C4273: 
> 'ObjectInteractorStyle::OnLeftButtonUp' : inconsistent dll linkage
> objectInteractorStyle.cpp(30) : warning C4273: 
> 'ObjectInteractorStyle::OnRightButtonDown' : inconsistent dll linkage
> objectInteractorStyle.cpp(34) : warning C4273: 
> 'ObjectInteractorStyle::OnRightButtonUp' : inconsistent dll linkage
> 2 error(s), 7 warning(s)
>
>
> _______________________________________________
> This is the private VTK discussion list. Please keep messages 
> on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>




More information about the vtkusers mailing list