See my answer to this thread: https://forum.nim-lang.org/t/8429
You can also see here for the section in the manual.
If the cpp class changes, I'd have to update the local version as well.
But if you use c2nim you can run c2nim again should the cpp class change.
this may help:
# cpp integration
# compile w/
# nim cpp -r cpp01.nim
{.emit: """
class Foo {
public:
int i,j,k;
};
""".}
type Foo {.importcpp: "class Foo", nodecl.} = object
i:cint
j:cint
k:cint
proc `$`(f:Foo):string="Foo(i:" & $f.i & ", j:" & $f.j & ", k:" & $f.k & ")"
var foo:Foo
echo foo