_GLOBAL__sub_D_control undefined reference to C++ class

I have a very simple MouseTrapCar.ino file, which calls the actual functionality in a C++ class.

#include "CarControl.h"

CarControl control;

void setup()
{
    control.Setup();
}

void loop() 
{
    control.Loop();
}

When I build using a derivative of queezy's cmake-arduino (from a CLion Arduino plugin), I get link errors:

Scanning dependencies of target MouseTrapCar
[ 96%] Building CXX object CMakeFiles/MouseTrapCar.dir/MouseTrapCar_MouseTrapCar.ino.cpp.obj
[100%] Linking CXX executable MouseTrapCar.elf
CMakeFiles/MouseTrapCar.dir/MouseTrapCar_MouseTrapCar.ino.cpp.obj: In function `_GLOBAL__sub_D_control':
/home/fbrier/Projects/MouseTrapCar/MouseTrapCar.ino:8: undefined reference to `CarControl::Setup()'
/home/fbrier/Projects/MouseTrapCar/MouseTrapCar.ino:8: undefined reference to `CarControl::Loop()'
/home/fbrier/Projects/MouseTrapCar/MouseTrapCar.ino:8: undefined reference to `CarControl::CarControl()'
/home/fbrier/Projects/MouseTrapCar/MouseTrapCar.ino:8: undefined reference to `CarControl::~CarControl()'
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/MouseTrapCar.dir/build.make:89: MouseTrapCar.elf] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/MouseTrapCar.dir/all] Error 2
gmake: *** [Makefile:84: all] Error 2

I am new to Arduino, but an experienced C++ developer. I heard the Arduino IDE was limiting once your app got more complex, so it seemed a good idea to just start with CLion and CMake. The errors could be a name mangling issue, where the .ino file is not resolving references with the class in the .h/.cpp. However, googling did not turn up users with similar problems. Maybe a CMake file error? I would be glad to post all the code. I was holding off pushing these latest changes to GitHub until it successfully built. Thank you.

If you run winblows you can get Atmel Studio 7 free.

You may have an invalid CarControl.h, lacking terminating brace. What if you remove the calls to control.???();

Next guess: builder cannot find CarControl.cpp. Move both CarControl files into your library folder, subfolder CarControl. See: writing your own Arduino library.

@GoForSmoke Alas, my workstation is Linux, although I do run Windows in a VM for Fusion 360 and playing ESO.

@DrDiettrich There was not missing brace, but your suggestion to put in a sub-directory as a "library" was awesome and worked wonderfully. A number of compile errors showed up, so apparently, you were correct, it was not even parsing the .cpp and header files. It all links. Thank you very much!

Oh cripes, shoulda said with Arduino I keep the library files in the same folder as the project. Then my edits to that code will go to library it compiles instead of compiling from a library folder and saving changes to the project folder.

The free IDE is worth wayyy more than it costs but there's some corners you gotta watch out for.

If you're going to edit/develop library files, keep them right in the project folder and copy out to libraries when you're done.