<p>I did the following command on Ubuntu and it worked.</p>

<pre><code>sudo apt-get install libdb++-dev
</code></pre>

CC BY-SA 3.0
2014-05-12T07:23:31.000Z
brew install berkeley-db on Mac OS X
Felipe
CC BY-SA 3.0
2013-05-01T05:56:39.963Z
2013-05-01T05:56:39.963Z
Kieran Andrews
<p>I think you can install the libdb4.8++-dev package if you add the stable debian repo in your sources.list.</p>

<p>I did it on my system (debian sid), and now I can proceed to the installation.  I haven't tested the full bitcoind compilation yet, though.</p>

CC BY-SA 3.0
2013-03-10T23:56:31.890Z
libdb5.1++-dev also works, for those who would rather install later versions of packages. +1 thanks!
L0j1k
CC BY-SA 3.0
2012-09-20T09:47:30.377Z
2012-09-20T09:47:30.377Z
grondilu
<p>it compiles nice with later versions but be carefull and do not mix up db*-dev and db*++-dev.
Here you have to install the "++" version</p>

CC BY-SA 3.0
2013-05-24T06:01:22.443Z
Thanks, that's what I was missing ,db*++-dev instead of db*-dev
Squeezle
CC BY-SA 3.0
2013-03-06T09:58:20.543Z
2013-03-06T09:58:20.543Z
Tyra Misoux
<p>Try this:</p>

<p>sudo apt-get install libdb5.3++-dev</p>

<p>The latest stable package, I used this on the new Bitcoin-Qt 8.3 patch from GIT and it compiled flawlessly, for any files that had that as an include.</p>

<p>Note:</p>

<p>If you are using gcc / g++ version 4.8 and you were looking for libdb4.8++-dev, there is a reason why you couldn't find an installation candidate.</p>

<p>Don't confuse the libdb5.3++-dev package with the version of the gcc / g++ compiler and linker, they're not part of the gcc / g++ but an add-on development library regardless of what version of the compiler you use.</p>

CC BY-SA 3.0
2013-08-15T00:37:26.083Z
2013-08-15T00:37:26.083Z
user6016
<p>If you're building under <a href="https://brew.sh" rel="nofollow noreferrer">homebrew</a> on MacOS, install the requisite header files via</p>
<pre><code>brew install berkeley-db
</code></pre>

CC BY-SA 4.0
2020-12-15T02:16:26.047Z
2020-12-15T02:16:26.047Z
jhfrontz
<p>You need to add <code>-I &lt;directory&gt;</code> to the end of the <code>CXX=g++</code> line in the <code>Makefile</code>. The directory should be the one that contains the <code>db_cxx.h</code> file from your BerkeleyDB installation. So, change:</p>

<pre><code>CXX=g++
</code></pre>

<p>to</p>

<pre><code>CXX=g++ -I /usr/local/BerkeleyDB.5.1
</code></pre>

<p>You may need a <code>/include</code> or something like that on the end of that. It depends exactly which directory holds the <code>db_cxx.h</code> file.</p>

CC BY-SA 3.0
2011-10-09T17:37:04.720Z
Worked a treat with Berkeley 5.1.8, thanks.
Sean Chapman
CC BY-SA 3.0
2012-03-10T10:28:54.477Z
Yup thanks, works a treat with Berkeley 5.1.8
ktec
CC BY-SA 3.0
2011-10-09T16:58:03.137Z
2011-10-09T16:58:03.137Z
David Schwartz
<p>When building bitcoind on LinuxCoin (Debian based), I receive this error</p>

<blockquote>
  <p>"headers.h:36:20: fatal error: db_cxx.h: No such file or directory"</p>
</blockquote>

<p>following the instructions at <a href="https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.txt">https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.txt</a></p>

<p>I believe the error is caused by the package "libdb4.8++-dev" being non-existant for the distro, as when attempting to "apt-get install" that, I get:</p>

<blockquote>
  <p>Package libdb4.8++-dev is not available, but is referred to by another package.
  This may mean that the package is missing, has been obsoleted, or
  is only available from another source</p>
  
  <p>E: Package 'libdb4.8++-dev' has no installation candidate</p>
</blockquote>

<p>NOTE: libdb4.8-dev and all other dependencies are already installed.</p>

<p>It's probably a silly mistake on my part but any help is appreciated! Thanks.</p>

CC BY-SA 3.0
2013-05-13T12:55:35.020Z
@DavidSchwartz - just a small correction - I found the package is called libdb-dev
Richard Green
CC BY-SA 3.0
2011-10-09T15:29:12.110Z
Do you have a `db_cxx.h` file anywhere? You can check with `locate`.
David Schwartz
CC BY-SA 3.0
2011-10-09T15:33:15.123Z
No. I used to have the db-5.1.8 version but I removed that as the readme said I needed 4.8.
Sean Chapman
CC BY-SA 3.0
2011-10-09T15:53:49.933Z
If you don't have libdb-devel installed, it won't compile. You can use 5.1.8, just realize your files won't be compatible with builds made with earlier versions.
David Schwartz
CC BY-SA 3.0
2011-10-09T16:03:00.393Z
Yeah. I've redownloaded and compiled 5.1.8 now and that's all okay but I'm getting the same error. Not sure how to tweak this makefile to include the db5.1.8 directories
Sean Chapman
CC BY-SA 3.0
2011-10-09T16:13:06.823Z
The makefile I am using is: http://pastebin.com/wGpPNjEb. My db-5.1.8 directories are located at /usr/local/BerkeleyDB.5.1/
Sean Chapman
<bitcoind>
When building bitcoind, I receive error "headers.h:36:20: fatal error: db_cxx.h: No such file or directory"
Sean Chapman
# When building bitcoind, I receive error "headers.h:36:20: fatal error: db_cxx.h: No such file or directory"

(Asked by: username_0 on 2011-10-09)

When building bitcoind on LinuxCoin (Debian based), I receive this error

> "headers.h:36:20: fatal error: db\_cxx.h: No such file or directory"

following the instructions at <https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.txt>

I believe the error is caused by the package "libdb4.8++-dev" being non-existant for the distro, as when attempting to "apt-get install" that, I get:

> Package libdb4.8++-dev is not available, but is referred to by another package.
> This may mean that the package is missing, has been obsoleted, or
> is only available from another source
>
> E: Package 'libdb4.8++-dev' has no installation candidate

NOTE: libdb4.8-dev and all other dependencies are already installed.

It's probably a silly mistake on my part but any help is appreciated! Thanks.

**Tags:** bitcoind

> **Comments:**
> **username_2**: Do you have a `db_cxx.h` file anywhere? You can check with `locate`.  
> **username_0**: No. I used to have the db-5.1.8 version but I removed that as the readme said I needed 4.8.  
> **username_2**: If you don't have libdb-devel installed, it won't compile. You can use 5.1.8, just realize your files won't be compatible with builds made with earlier versions.  
> **username_0**: Yeah. I've redownloaded and compiled 5.1.8 now and that's all okay but I'm getting the same error. Not sure how to tweak this makefile to include the db5.1.8 directories  
> **username_0**: The makefile I am using is: http://pastebin.com/wGpPNjEb. My db-5.1.8 directories are located at /usr/local/BerkeleyDB.5.1/  
> **username_1**: @DavidSchwartz - just a small correction - I found the package is called libdb-dev  

---

## 6 answers

### Answer by username_2 on 2011-10-09. Score: 7 | Accepted answer

You need to add -I  to the end of the CXX=g++ line in the Makefile. The directory should be the one that contains the db_cxx.h file from your BerkeleyDB installation. So, change:
CXX=g++

to
CXX=g++ -I /usr/local/BerkeleyDB.5.1

You may need a /include or something like that on the end of that. It depends exactly which directory holds the db_cxx.h file.

> **Comments:**
> **username_0**: Worked a treat with Berkeley 5.1.8, thanks.  
> **username_11**: Yup thanks, works a treat with Berkeley 5.1.8  

---

### Answer by username_3 on 2013-05-01. Score: 21

I did the following command on Ubuntu and it worked.
sudo apt-get install libdb++-dev

> **Comments:**
> **username_4**: brew install berkeley-db on Mac OS X  

---

### Answer by username_5 on 2012-09-20. Score: 5

I think you can install the libdb4.8++-dev package if you add the stable debian repo in your sources.list.

I did it on my system (debian sid), and now I can proceed to the installation. I haven't tested the full bitcoind compilation yet, though.

> **Comments:**
> **username_6**: libdb5.1++-dev also works, for those who would rather install later versions of packages. +1 thanks!  

---

### Answer by username_7 on 2013-03-06. Score: 1

it compiles nice with later versions but be carefull and do not mix up db\*-dev and db\*++-dev.
Here you have to install the "++" version

> **Comments:**
> **username_8**: Thanks, that's what I was missing ,db*++-dev instead of db*-dev  

---

### Answer by username_9 on 2013-08-15. Score: 0

Try this:

sudo apt-get install libdb5.3++-dev

The latest stable package, I used this on the new Bitcoin-Qt 8.3 patch from GIT and it compiled flawlessly, for any files that had that as an include.

Note:

If you are using gcc / g++ version 4.8 and you were looking for libdb4.8++-dev, there is a reason why you couldn't find an installation candidate.

Don't confuse the libdb5.3++-dev package with the version of the gcc / g++ compiler and linker, they're not part of the gcc / g++ but an add-on development library regardless of what version of the compiler you use.


---

### Answer by username_10 on 2020-12-15. Score: 0

If you're building under homebrew on MacOS, install the requisite header files via
brew install berkeley-db


---

