# Compiling without CMake

**URL:** <https://discourse.vtk.org/t/compiling-without-cmake/11044>\
**Category:** Development\
**Created:** [March 25, 2023, 11:05am UTC](https://discourse.vtk.org/t/compiling-without-cmake/11044 "2023-03-25T11:05:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mantielero](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/9de053/32.png) [@mantielero](https://discourse.vtk.org/u/mantielero)\
**Post date:** [March 25, 2023, 11:05am UTC](https://discourse.vtk.org/t/compiling-without-cmake/11044/1 "2023-03-25T11:05:05Z")

</div>

I am new to vtk. I’d like to explore the possibility about creating some bindings for VTK. As a first step, I need to know how to compile a basic example but without using CMake.

Up to know, I tried:

1. Just by exploring the missing symbols:

```sh
g++ -std=c++11 -I/usr/include/vtk -lvtkCommonCore -lvtkCommonColor -lvtkFiltersSources -lvtkInteractionStyle -lvtkRenderingContextOpenGL2 -lvtkRenderingCore -lvtkRenderingFreeType -lvtkRenderingGL2PSOpenGL2 -lvtkRenderingOpenGL2 -lvtksys -lvtkCommonExecutionModel ex01_cylinder.cpp -o ex01_cylinder

```

1. By exploring `link.txt` created with cmake:

```sh
g++ -std=c++11 -I/usr/include/vtk -lvtkInteractionStyle -lvtkRenderingContextOpenGL2 -lvtkRenderingGL2PSOpenGL2 -lvtkRenderingOpenGL2 -lvtkRenderingContext2D -lvtkRenderingFreeType -lfreetype -lvtkRenderingHyperTreeGrid -lvtkRenderingUI -lvtkRenderingCore -lvtkCommonColor -lvtkFiltersSources -lvtkFiltersGeneral -lvtkFiltersCore -lvtkCommonExecutionModel -lGLEW -lX11 -lvtkCommonDataModel -lvtkCommonTransforms -lvtkCommonMisc -lvtkCommonMath -lvtkCommonCore -lvtksys -ldl -ltbb -lgomp -Wl,-Bstatic -lpthread -Wl,-Bdynamic -lvtkkissfft ex01_cylinder.cpp -o ex01_cylinder

```

Both examples aboce create the executable, but for some reason it is not interactive. When I compile the same code (which the Hello World cylinder) I am able to interact with the cylinder.

Any clue about what I am missing in the compilation line?

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)\
**Post date:** [March 30, 2023, 9:39pm UTC](https://discourse.vtk.org/t/compiling-without-cmake/11044/2 "2023-03-30T21:39:39Z")

</div>

> [@mantielero](#):
>
> Any clue about what I am missing in the compilation line?

Object factory initialization. You need to link to rendering and interaction implementations and pass a `-D` (or embed it into the source) to have the factories initialized. See the docs [here](https://gitlab.kitware.com/vtk/vtk/-/blob/0c20a7196919fa66a78f0bae090f384f8b2d8da3/CMake/vtkModule.cmake#L3049) and for the `vtk_module_autoinit` function.

Really, it’s just going to be easier to use CMake, even if you end up with something like [`paraview-config`](https://gitlab.kitware.com/paraview/paraview/-/blob/master/Clients/CommandLineExecutables/paraview-config.in).

---

<div class="post-metadata">

**Author:** ![mantielero](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/9de053/32.png) [@mantielero](https://discourse.vtk.org/u/mantielero)\
**Post date:** [April 14, 2023, 2:10pm UTC](https://discourse.vtk.org/t/compiling-without-cmake/11044/3 "2023-04-14T14:10:05Z")

</div>

Thanks for the reply and sorry for coming back to you so late (I’ve been off for a couple of weeks). Just to thank you. It was spot on.

Sadly, in my case I need to avoid cmake. I need to think about how to do it.
