# Get error when generating dictionary

**URL:** <https://root-forum.cern.ch/t/get-error-when-generating-dictionary/60164>\
**Category:** Newbie\
**Tags:** root\
**Created:** [July 11, 2024, 6:09am UTC](https://root-forum.cern.ch/t/get-error-when-generating-dictionary/60164 "2024-07-11T06:09:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Crisps](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/crisps/32/39101_2.png) [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Post date:** [July 11, 2024, 6:09am UTC](https://root-forum.cern.ch/t/get-error-when-generating-dictionary/60164/1 "2024-07-11T06:09:04Z")

</div>

Dear experts

When I tried to generate the dictionary of `std::vector<TVector2>` I got the error while compiling, here is what I did:  
vector\_of\_TVector2\_LinkDef.h:

```auto
#ifdef __CLING__
#pragma link C++ class std::vector<TVector2>+;
#endif

```

in CMakeLists.txt, add this line:

```auto
ROOT_GENERATE_DICTIONARY(${CMAKE_CURRENT_SOURCE_DIR}/src/vector_of_TVector2 ${ROOT_ROOT}/include/TVector2.h LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/src/vector_of_TVector2_LinkDef.h)

add_library(Analyzer ${ROOT_DICTS}
                ${CMAKE_CURRENT_SOURCE_DIR}/src/dummy.cxx
                ${CMAKE_CURRENT_SOURCE_DIR}/src/dummy.hxx
                ${CMAKE_CURRENT_SOURCE_DIR}/src/vector_of_TVector2.cxx
)

```

When I compile I got this error:

```auto
make[2]: *** No rule to make target `../src/vector_of_TVector2.hxx', needed by `dict/vector_of_TVector2_Dict.cxx'. Stop.
make[2]: *** Waiting for unfinished jobs....
[10%] Generating ../src/vector_of_TVector2.cxx, libvector_of_TVector2_rdict.pcm, libvector_of_TVector2.rootmap
make[1]: *** [CMakeFiles/Analyzer.dir/all] Error 2
make: *** [all] Error 2

```

What should I do?

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [July 11, 2024, 10:18am UTC](https://root-forum.cern.ch/t/get-error-when-generating-dictionary/60164/2 "2024-07-11T10:18:05Z")

</div>

Hello,

I am not sure what causes this error, but I would not use as target name in `ROOT_GENERATE_DICTIONARY`,

`${CMAKE_CURRENT_SOURCE_DIR}/src/vector_of_TVector2`

just follow examples used in root and call it something else , e.g. `G__vector_of_TVector2`

Lorenzo

---

<div class="post-metadata">

**Author:** ![Crisps](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/crisps/32/39101_2.png) [@Crisps](https://root-forum.cern.ch/u/Crisps)\
**Post date:** [July 11, 2024, 10:34am UTC](https://root-forum.cern.ch/t/get-error-when-generating-dictionary/60164/3 "2024-07-11T10:34:55Z")

</div>

Thank you for the answer! What do you mean “target”? there is no file named vector\_of\_TVector2 in my source dir though

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [July 11, 2024, 10:53am UTC](https://root-forum.cern.ch/t/get-error-when-generating-dictionary/60164/4 "2024-07-11T10:53:56Z")

</div>

The target is just what cmake will build and it does not need to reflect a file.  
You can see the examples in the root, for example

> <https://github.com/root-project/root/blob/master/math/genvector/CMakeLists.txt>

And see what is used as first value passed in ROOT\_GENERATE\_DICTIONARY
