# Issue compiling custom reader plugin with accompanying VTK reader

**URL:** https://discourse.paraview.org/t/issue-compiling-custom-reader-plugin-with-accompanying-vtk-reader/5286
**Category:** Development
**Created:** [September 7, 2020, 2:20pm UTC](https://discourse.paraview.org/t/issue-compiling-custom-reader-plugin-with-accompanying-vtk-reader/5286 "2020-09-07T14:20:27Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![mdjong](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/ecc23a/32.png) [@mdjong](https://discourse.paraview.org/u/mdjong)
#### Post date: [September 7, 2020, 2:20pm UTC](https://discourse.paraview.org/t/issue-compiling-custom-reader-plugin-with-accompanying-vtk-reader/5286/1 "2020-09-07T14:20:27Z")

</div>

Hey guys,

I’m currently trying to create a reader for the JSON based CityJSON format (mix of CityGML and GeoJSON ([www.cityjson.org](http://www.cityjson.org))).

As far as I understand I will need to create a new VTK reader to accompany the ParaView plugin, so I’m using the [ElevationFilter](https://discourse.paraview.org/t/creating-custom-paraview-reader/5027) as an example. Running into a few issues however, so was hoping someone could help:

When I try to compile I run into the following error:

```auto
In file included from /mnt/hdd/Repositories/Paraview-CityJSONReader/Plugin/CityJSONReaders/vtkMyCityJSONReader.cxx:1:
/mnt/hdd/Repositories/Paraview-CityJSONReader/Plugin/CityJSONReaders/vtkMyCityJSONReader.h:6:49: error: expected initializer before ‘:’ token
    6 | class CITYJSONREADER_EXPORT vtkMyCityJSONReader : public vtkPolyData
      |                                               

```

 ![image](https://discourse.paraview.org/uploads/default/original/2X/4/403714a4f8751e3016bc8c79d0a6a83538c23057.png)

The code I have so far is:  
vtkMyCityJSONReader.cxx

```auto
#include "vtkMyCityJSONReader.h"

#include "vtkObjectFactory.h"

vtkStandardNewMacro(vtkMyCityJSONReader);

//----------------------------------------------------------------------------
vtkMyCityJSONReader::vtkMyCityJSONReader()
{
}

//----------------------------------------------------------------------------
vtkMyCityJSONReader::~vtkMyCityJSONReader()
{
}

//----------------------------------------------------------------------------
void vtkMyCityJSONReader::PrintSelf(ostream& os, vtkIndent indent)
{
    this->Superclass::PrintSelf(os, indent);
}

```

vtkMyCityJSONReader.h

```auto
#ifndef vtkMyCityJSONReader_h
#define vtkMyCityJSONReader_h

#include "vtkPolyData.h"

class CITYJSONREADER_EXPORT vtkMyCityJSONReader : public vtkPolyData
{
public:
    static vtkMyCityJSONReader* New();
    vtkTypeMacro(vtkMyCityJSONReader, vtkPolyData);
    void PrintSelf(ostream& os, vtkIndent indent) override;

protected:
    vtkMyCityJSONReader();
    ~vtkMyCityJSONReader();

private:
    vtkMyCityJSONReader(const vtkMyCityJSONReader&) = delete;
    void operator=(const vtkMyCityJSONReader&) = delete;
};

#endif

```

CMakeLists.txt

```auto
cmake_minimum_required(VERSION 3.8)
project(CityJSONReader)

find_package(ParaView REQUIRED)

option(BUILD_SHARED_LIBS "Build shared libraries" ON)
enable_testing()

# Required for python testing
set(_vtk_build_TEST_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Testing/Temporary)

include(GNUInstallDirs)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")

set("_paraview_plugin_default_${CMAKE_PROJECT_NAME}" ON)
paraview_plugin_scan(
        PLUGIN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/Plugin/paraview.plugin"
        PROVIDES_PLUGINS plugins
        REQUIRES_MODULES required_modules)

foreach (module IN LISTS required_modules)
    if (NOT TARGET "${module}")
        message(#FATAL_ERROR
                "Skipping example ${CMAKE_PROJECT_NAME}: Missing required module: "
                "${module}")
        return ()
    endif ()
endforeach ()

paraview_plugin_build(
        RUNTIME_DESTINATION "${CMAKE_INSTALL_BINDIR}"
        LIBRARY_DESTINATION "${CMAKE_INSTALL_LIBDIR}"
        LIBRARY_SUBDIRECTORY "${PARAVIEW_PLUGIN_SUBDIR}"
        PLUGINS ${plugins})

```

---

<div class="post-metadata">

### Author: ![danlipsa](https://discourse.paraview.org/user_avatar/discourse.paraview.org/danlipsa/32/1563_2.png) [@danlipsa](https://discourse.paraview.org/u/danlipsa)
#### Post date: [September 7, 2020, 3:29pm UTC](https://discourse.paraview.org/t/issue-compiling-custom-reader-plugin-with-accompanying-vtk-reader/5286/2 "2020-09-07T15:29:54Z")

</div>

I would take a look at the CityGML reader  
[https://blog.kitware.com/citygml-reader/](https://blog.kitware.com/citygml-reader/)  
and integrate it in ParaView the same way first. When you get that working, you can make the code a ParaView plugin as a separate step.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [September 7, 2020, 3:31pm UTC](https://discourse.paraview.org/t/issue-compiling-custom-reader-plugin-with-accompanying-vtk-reader/5286/3 "2020-09-07T15:31:46Z")

</div>

`#include "YourModuleName.h" // for export macro`

is missing.

---

<div class="post-metadata">

### Author: ![mdjong](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/ecc23a/32.png) [@mdjong](https://discourse.paraview.org/u/mdjong)
#### Post date: [September 7, 2020, 3:44pm UTC](https://discourse.paraview.org/t/issue-compiling-custom-reader-plugin-with-accompanying-vtk-reader/5286/4 "2020-09-07T15:44:59Z")

</div>

Thanks Mathieu, I was just wondering what ‘YourModuleName’ is going to end up being, because in the examples I see “vtkIOGeoJSONModule” for the module “vtkGeoJSONReader”, but am unable to actually find the header file that is being referenced. How is this include chosen?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [September 7, 2020, 3:51pm UTC](https://discourse.paraview.org/t/issue-compiling-custom-reader-plugin-with-accompanying-vtk-reader/5286/5 "2020-09-07T15:51:33Z")

</div>

it is coming from the vtk.module file alongside your vtkMyCityJSONReader.cxx.

---

<div class="post-metadata">

### Author: ![mdjong](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/ecc23a/32.png) [@mdjong](https://discourse.paraview.org/u/mdjong)
#### Post date: [September 7, 2020, 6:19pm UTC](https://discourse.paraview.org/t/issue-compiling-custom-reader-plugin-with-accompanying-vtk-reader/5286/6 "2020-09-07T18:19:28Z")

</div>

Great, thanks Mathieu, I have a module that’s compiling now, so that’s awesome

Must be a few hurdles still on the way, but at least this brings me some steps closer!
