# \[SOLVED\] LLDB failed when I connected my c++ lib

**URL:** <https://forums.swift.org/t/solved-lldb-failed-when-i-connected-my-c-lib/63712>\
**Category:** LLDB\
**Tags:** cxx-interop\
**Created:** [March 14, 2023, 11:34pm UTC](https://forums.swift.org/t/solved-lldb-failed-when-i-connected-my-c-lib/63712 "2023-03-14T23:34:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SpectralDragon](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/spectraldragon/32/5035_2.png) [@SpectralDragon](https://forums.swift.org/u/SpectralDragon)\
**Post date:** [March 14, 2023, 11:34pm UTC](https://forums.swift.org/t/solved-lldb-failed-when-i-connected-my-c-lib/63712/1 "2023-03-14T23:34:02Z")

</div>

I connected C++ library to my executable SPM project and set `-enable-experimental-cxx-interop` to swift settings, and when I try to debug with LLDB, I received the next error messages

```sh
(lldb) po self
error: expression failed to parse:
unknown error

```

and

```sh
(lldb) po self
warning: Swift error in scratch context: /Users/v.prusakov/Developer/AdaEngine/Sources/AdaBox2d/box2d_swift.hpp:11:10: note: while building module 'box2d' imported from /Users/v.prusakov/Developer/AdaEngine/Sources/AdaBox2d/box2d_swift.hpp:11:
#include <box2d/box2d.h>
         ^

<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Users/v.prusakov/Developer/box2d-swift/Sources/box2d/include/box2d/box2d.h"
        ^

/Users/v.prusakov/Developer/box2d-swift/Sources/box2d/include/box2d/box2d.h:28:10: note: in file included from /Users/v.prusakov/Developer/box2d-swift/Sources/box2d/include/box2d/box2d.h:28:
#include "b2_settings.h"
         ^

error: /Users/v.prusakov/Developer/box2d-swift/Sources/box2d/include/box2d/b2_math.h:47:35: error: use of undeclared identifier 'xIn'
        b2Vec2(float xIn, float yIn) : x(xIn), y(yIn) {}
                                         ^

error: /Users/v.prusakov/Developer/box2d-swift/Sources/box2d/include/box2d/b2_math.h:138:2: error: duplicate member 'b2Vec3'
        b2Vec3(float xIn, float yIn, float zIn) : x(xIn), y(yIn), z(zIn) {}
        ^

/Users/v.prusakov/Developer/box2d-swift/Sources/box2d/include/box2d/b2_math.h:135:2: note: previous declaration is here
        b2Vec3() = default;
        ^

error: too many errors emitted, stopping now
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "box2d_swift.hpp"
        ^

error: /Users/v.prusakov/Developer/AdaEngine/Sources/AdaBox2d/box2d_swift.hpp:11:10: error: could not build module 'box2d'
#include <box2d/box2d.h>
         ^

error: could not build Objective-C module 'AdaBox2d'
.
Shared Swift state for AdaEditor has developed fatal errors and is being discarded.
REPL definitions and persistent names/types will be lost.

error: expression failed to parse:
unknown error

```

My app perfectly run on Xcode 14.3 beta and Swift 5.7 (I got same behavior on 5.8), but debugging is broken.

How to fix that??

---

<div class="post-metadata">

**Author:** ![augusto2112](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/augusto2112/32/10731_2.png) [@augusto2112](https://forums.swift.org/u/augusto2112)\
**Post date:** [March 15, 2023, 3:39am UTC](https://forums.swift.org/t/solved-lldb-failed-when-i-connected-my-c-lib/63712/2 "2023-03-15T03:39:25Z")

</div>

Hi @SpectralDragon, for now, you can add the following to your lldbinit file:

```swift
settings set target.experimental.swift-enable-cxx-interop true

```

---

<div class="post-metadata">

**Author:** ![SpectralDragon](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/spectraldragon/32/5035_2.png) [@SpectralDragon](https://forums.swift.org/u/SpectralDragon)\
**Post date:** [March 15, 2023, 11:42am UTC](https://forums.swift.org/t/solved-lldb-failed-when-i-connected-my-c-lib/63712/3 "2023-03-15T11:42:28Z")

</div>

> [@augusto2112](#):
>
> `settings set target.experimental.swift-enable-cxx-interop true`

Thanks, that's solved my issue!
