The wiki page you cite is still relevant for cmake/visual studio with shared libraries. You do NOT need this line in your CMakeLists.txt file:

ADD_LIBRARY(vtkFiniteDifference SHARED vtkFiniteDifference.cxx)

The ADD_PARAVIEW_PLUGIN should do that for you.

class MyStaticFunctionClass
{
public:
static VTK_EXPORT void MyExportedFunction(int i);
};
___________________________________________________________
Mike Jackson                      www.bluequartz.net
Principal Software Engineer       mike.jack...@bluequartz.net
BlueQuartz Software               Dayton, Ohio

Disclaimer: I originally wrote the wiki entry. If there _are_ problems with it then please let me know and I will fix the entry.

On Jul 6, 2010, at 7:56 AM, Fred Fred wrote:

Because I tried it but it did not work:
- the first error is due to this line: static MYLIB_EXPORT vtkFiniteDifference *New();
    that is I followed the advice at the end of the cmake page:
If you have some static functions then you will need something like the following:

class MyStaticFunctionClass
{
  public:
    static MYLIB_EXPORT void MyExportedFunction(int i);
};
but it seems that it does not work with constructors since contructors do not have any return type.

My CMakeFiles.txt looks like this:

FIND_PACKAGE(ParaView REQUIRED)
INCLUDE(${PARAVIEW_USE_FILE})

ADD_LIBRARY(vtkFiniteDifference SHARED vtkFiniteDifference.cxx)

# Add the new plugin in the MOSART submenu
ADD_PARAVIEW_PLUGIN(FiniteDifference "1.0"
                    SERVER_MANAGER_XML FiniteDifference.xml
                    SERVER_MANAGER_SOURCES vtkFiniteDifference.cxx
                    GUI_RESOURCE_FILES ../MOSART_GUI.xml)

INCLUDE_DIRECTORIES(/Developpement/ParaView-3.8.0/VTK)

Is there any redondancy between the ADD_LIBRARY and the ADD_PARAVIEW_PLUGIN lines?

Any help?


------ Build started: Project: FiniteDifference, Configuration: Release Win32 ------
Compiling...
vtkFiniteDifferenceClientServer.cxx
C:\Developpement\ParaView_Plugins\FiniteDifference \vtkFiniteDifference.h(34) : error C2487: 'New' : member of dll interface class may not be declared with dll interface
vtkFiniteDifference.cxx
C:\Developpement\ParaView_Plugins\FiniteDifference \vtkFiniteDifference.h(34) : error C2487: 'New' : member of dll interface class may not be declared with dll interface ..\vtkFiniteDifference.cxx(24) : warning C4273: 'vtkFiniteDifference::CollectRevisions' : inconsistent dll linkage C:\Developpement\ParaView_Plugins\FiniteDifference \vtkFiniteDifference.h(29) : see previous definition of 'CollectRevisions' ..\vtkFiniteDifference.cxx(25) : warning C4273: 'vtkFiniteDifference::New' : inconsistent dll linkage C:\Developpement\ParaView_Plugins\FiniteDifference \vtkFiniteDifference.h(34) : see previous definition of 'New' ..\vtkFiniteDifference.cxx(28) : warning C4273: 'vtkFiniteDifference::vtkFiniteDifference' : inconsistent dll linkage C:\Developpement\ParaView_Plugins\FiniteDifference \vtkFiniteDifference.h(58) : see previous definition of '{ctor}' ..\vtkFiniteDifference.cxx(33) : warning C4273: 'vtkFiniteDifference::~vtkFiniteDifference' : inconsistent dll linkage C:\Developpement\ParaView_Plugins\FiniteDifference \vtkFiniteDifference.h(59) : see previous definition of '{dtor}' ..\vtkFiniteDifference.cxx(41) : warning C4273: 'vtkFiniteDifference::RequestData' : inconsistent dll linkage C:\Developpement\ParaView_Plugins\FiniteDifference \vtkFiniteDifference.h(61) : see previous definition of 'RequestData' ..\vtkFiniteDifference.cxx(124) : warning C4273: 'vtkFiniteDifference::SetAxis' : inconsistent dll linkage C:\Developpement\ParaView_Plugins\FiniteDifference \vtkFiniteDifference.h(51) : see previous definition of 'SetAxis' ..\vtkFiniteDifference.cxx(132) : warning C4273: 'vtkFiniteDifference::PrintSelf' : inconsistent dll linkage C:\Developpement\ParaView_Plugins\FiniteDifference \vtkFiniteDifference.h(30) : see previous definition of 'PrintSelf'
Generating Code...
Build log was saved at "file://c:\Developpement\ParaView_Plugins \FiniteDifference\PV\FiniteDifference.dir\Release\BuildLog.htm"
FiniteDifference - 2 error(s), 7 warning(s)
------ Build started: Project: vtkFiniteDifference, Configuration: Release Win32 ------
Compiling...
vtkFiniteDifference.cxx
C:\Developpement\ParaView_Plugins\FiniteDifference \vtkFiniteDifference.h(34) : error C2487: 'New' : member of dll interface class may not be declared with dll interface ..\vtkFiniteDifference.cxx(24) : warning C4273: 'vtkFiniteDifference::CollectRevisions' : inconsistent dll linkage C:\Developpement\ParaView_Plugins\FiniteDifference \vtkFiniteDifference.h(29) : see previous definition of 'CollectRevisions' ..\vtkFiniteDifference.cxx(25) : warning C4273: 'vtkFiniteDifference::New' : inconsistent dll linkage C:\Developpement\ParaView_Plugins\FiniteDifference \vtkFiniteDifference.h(34) : see previous definition of 'New' ..\vtkFiniteDifference.cxx(28) : warning C4273: 'vtkFiniteDifference::vtkFiniteDifference' : inconsistent dll linkage C:\Developpement\ParaView_Plugins\FiniteDifference \vtkFiniteDifference.h(58) : see previous definition of '{ctor}' ..\vtkFiniteDifference.cxx(33) : warning C4273: 'vtkFiniteDifference::~vtkFiniteDifference' : inconsistent dll linkage C:\Developpement\ParaView_Plugins\FiniteDifference \vtkFiniteDifference.h(59) : see previous definition of '{dtor}' ..\vtkFiniteDifference.cxx(41) : warning C4273: 'vtkFiniteDifference::RequestData' : inconsistent dll linkage C:\Developpement\ParaView_Plugins\FiniteDifference \vtkFiniteDifference.h(61) : see previous definition of 'RequestData' ..\vtkFiniteDifference.cxx(124) : warning C4273: 'vtkFiniteDifference::SetAxis' : inconsistent dll linkage C:\Developpement\ParaView_Plugins\FiniteDifference \vtkFiniteDifference.h(51) : see previous definition of 'SetAxis' ..\vtkFiniteDifference.cxx(132) : warning C4273: 'vtkFiniteDifference::PrintSelf' : inconsistent dll linkage C:\Developpement\ParaView_Plugins\FiniteDifference \vtkFiniteDifference.h(30) : see previous definition of 'PrintSelf' Build log was saved at "file://c:\Developpement\ParaView_Plugins \FiniteDifference\PV\vtkFiniteDifference.dir\Release\BuildLog.htm"
vtkFiniteDifference - 1 error(s), 7 warning(s)
------ Skipped Build: Project: ALL_BUILD, Configuration: Release Win32 ------
Project not selected to build for this solution configuration
========== Build: 0 succeeded, 2 failed, 1 up-to-date, 1 skipped ==========


Votre vie privée l'est-elle vraiment ? Internet Explorer 8 vous protège gratuitement_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to