<p>1) Make new folders called <code>obj</code> and <code>obj-test</code> inside the <code>src</code> folder</p>

<p>2) Try to recompile</p>

CC BY-SA 3.0
2017-10-31T07:49:00.280Z
2017-11-02T11:09:29.180Z
2017-11-02T11:09:29.180Z
Chiok Sen
<p>Hi I am compiling an ALTCOIN forked from another coin, I'm using Ubuntu Server 16.04 LTS via SSH from a remotely hosted server. I believe I installed all dependencies because I have already compiled about 4 coin source codes.</p>

<p>But with this particular source I am getting build errors, I will copy and paste the errors from the command line.</p>

<p>So I typed in</p>

<pre><code>make -f makefile.unix USE_QRCODE=1  


the here is the results.
  -MMD -MF obj/key.d -o obj/key.o key.cpp

key.cpp:30:5: error: ‘secp256k1_context_t’ does not name a type
     secp256k1_context_t* ctx;
     ^
key.cpp: In constructor ‘{anonymous}::CSecp256k1Init::CSecp256k1Init()’:

key.cpp:32:9: error: ‘ctx’ was not declared in this scope
         ctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN);
         ^
key.cpp: In destructor ‘{anonymous}::CSecp256k1Init::~CSecp256k1Init()’:

key.cpp:35:35: error: ‘ctx’ was not declared in this scope
         secp256k1_context_destroy(ctx);
                                   ^
key.cpp: In member function ‘bool CKey::SetPrivKey(const CPrivKey&amp;, bool)’:

key.cpp:472:61: error: ‘class {anonymous}::CSecp256k1Init’ has no member named ‘ctx’
     if (!secp256k1_ec_privkey_import(instance_of_csecp256k1.ctx, (unsigned char*)begin(), &amp;privkey[0], privkey.size()))
                                                             ^
key.cpp:472:118: error: ‘secp256k1_ec_privkey_import’ was not declared in this scope
     if (!secp256k1_ec_privkey_import(instance_of_csecp256k1.ctx, (unsigned char*)begin(), &amp;privkey[0], privkey.size()))
                                                                                                                      ^
key.cpp: In member function ‘CPrivKey CKey::GetPrivKey() const’:

key.cpp:491:66: error: ‘class {anonymous}::CSecp256k1Init’ has no member named ‘ctx’
     int ret = secp256k1_ec_privkey_export(instance_of_csecp256k1.ctx, begin(), (unsigned char*)&amp;privkey[0], &amp;privkeylen, fCompressed);
                                                                  ^
key.cpp:491:133: error: ‘secp256k1_ec_privkey_export’ was not declared in this scope
     int ret = secp256k1_ec_privkey_export(instance_of_csecp256k1.ctx, begin(), (unsigned char*)&amp;privkey[0], &amp;privkeylen, fCompressed);
                                                                                                                                     ^
key.cpp: In member function ‘CPubKey CKey::GetPubKey() const’:

key.cpp:507:65: error: ‘class {anonymous}::CSecp256k1Init’ has no member named ‘ctx’
     int ret = secp256k1_ec_pubkey_create(instance_of_csecp256k1.ctx, (unsigned char*)pubkey.begin(), &amp;clen, begin(), fCompressed);
                                                                 ^
key.cpp: In member function ‘bool CKey::Sign(const uint256&amp;, std::vector&lt;unsigned char&gt;&amp;) const’:

key.cpp:529:57: error: ‘class {anonymous}::CSecp256k1Init’ has no member named ‘ctx’
         if (secp256k1_ecdsa_sign(instance_of_csecp256k1.ctx, hash.begin(), (unsigned char*)&amp;vchSig[0], &amp;nSigLen, begin(),  secp256k1_nonce_function_rfc6979, NULL))
                                                         ^
key.cpp: In member function ‘bool CKey::SignCompact(const uint256&amp;, std::vector&lt;unsigned char&gt;&amp;) const’:

key.cpp:553:75: error: ‘class {anonymous}::CSecp256k1Init’ has no member named ‘ctx’
         if (int ret = secp256k1_ecdsa_sign_compact(instance_of_csecp256k1.ctx, hash.begin(), &amp;vchSig[1], begin(), secp256k1_nonce_function_rfc6979, NULL, &amp;rec))
                                                                           ^
key.cpp:553:159: error: ‘secp256k1_ecdsa_sign_compact’ was not declared in this scope
         if (int ret = secp256k1_ecdsa_sign_compact(instance_of_csecp256k1.ctx, hash.begin(), &amp;vchSig[1], begin(), secp256k1_nonce_function_rfc6979, NULL, &amp;rec))
                                                                                                                                                               ^

key.cpp:553:17: warning: unused variable ‘ret’ [-Wunused-variable]
         if (int ret = secp256k1_ecdsa_sign_compact(instance_of_csecp256k1.ctx, hash.begin(), &amp;vchSig[1], begin(), secp256k1_nonce_function_rfc6979, NULL, &amp;rec))
                 ^

key.cpp: In member function ‘bool CKey::Load(CPrivKey&amp;, CPubKey&amp;, bool)’:

key.cpp:569:61: error: ‘class {anonymous}::CSecp256k1Init’ has no member named ‘ctx’
     if (!secp256k1_ec_privkey_import(instance_of_csecp256k1.ctx, (unsigned char*)begin(), &amp;privkey[0], privkey.size()))
                                                             ^

key.cpp:569:118: error: ‘secp256k1_ec_privkey_import’ was not declared in this scope
     if (!secp256k1_ec_privkey_import(instance_of_csecp256k1.ctx, (unsigned char*)begin(), &amp;privkey[0], privkey.size()))
                                                                                                                      ^
key.cpp: In member function ‘bool CPubKey::VerifyCompact(const uint256&amp;, const std::vector&lt;unsigned char&gt;&amp;) const’:

key.cpp:633:10: warning: unused variable ‘fComp’ [-Wunused-variable]
     bool fComp = IsCompressed();
          ^

key.cpp: In member function ‘bool CPubKey::IsFullyValid() const’:

key.cpp:655:60: error: ‘class {anonymous}::CSecp256k1Init’ has no member named ‘ctx’
     if (!secp256k1_ec_pubkey_verify(instance_of_csecp256k1.ctx, begin(), size()))
                                                            ^

key.cpp:655:80: error: ‘secp256k1_ec_pubkey_verify’ was not declared in this scope
     if (!secp256k1_ec_pubkey_verify(instance_of_csecp256k1.ctx, begin(), size()))
                                                                                ^

key.cpp: In member function ‘bool CPubKey::Decompress()’:

key.cpp:670:69: error: ‘class {anonymous}::CSecp256k1Init’ has no member named ‘ctx’

int ret = secp256k1_ec_pubkey_decompress(instance_of_csecp256k1.ctx, (unsigned char*)begin(), &amp;clen);
                                                                     ^
key.cpp:670:104: error: ‘secp256k1_ec_pubkey_decompress’ was not declared in this scope

int ret = secp256k1_ec_pubkey_decompress(instance_of_csecp256k1.ctx, (unsigned char*)begin(), &amp;clen);
                                                                                                        ^
key.cpp: In member function ‘bool CKey::Derive(CKey&amp;, unsigned char*, unsigned int, const unsigned char*) const’:

key.cpp:712:70: error: ‘class {anonymous}::CSecp256k1Init’ has no member named ‘ctx’

bool ret = secp256k1_ec_privkey_tweak_add(instance_of_csecp256k1.ctx, (unsigned char*)keyChild.begin(), out);
                                                                      ^
key.cpp: In member function ‘bool CPubKey::Derive(CPubKey&amp;, unsigned char*, unsigned int, const unsigned char*) const’:

key.cpp:731:69: error: ‘class {anonymous}::CSecp256k1Init’ has no member named ‘ctx’
     bool ret = secp256k1_ec_pubkey_tweak_add(instance_of_csecp256k1.ctx, (unsigned char*)pubkeyChild.begin(), pubkeyChild.size(), out);
                                                                     ^

makefile.unix:206: recipe for target 'obj/key.o' failed

make: *** [obj/key.o] Error 1
</code></pre>

<p>I have been trying to debug but I cant seem to get anywhere, can someone please help me out?</p>

<p>Thanks.</p>

CC BY-SA 3.0
2017-03-11T05:33:05.057Z
Try downloading and compiling this: https://github.com/bitcoin-core/secp256k1
Nick ODell
CC BY-SA 3.0
2017-03-11T05:54:17.993Z
I did that before I tried running the makefile.
user54097
CC BY-SA 3.0
2017-03-11T06:12:58.737Z
Does it need to be included into the system environment? And if it does what specific file needs to be included?
user54097
<altcoin><ubuntu><make>
Compiling an ALTCOIN on Ubuntu, getting errors during make
user54097
# Compiling an ALTCOIN on Ubuntu, getting errors during make

(Asked by: username_0 on 2017-03-11)

Hi I am compiling an ALTCOIN forked from another coin, I'm using Ubuntu Server 16.04 LTS via SSH from a remotely hosted server. I believe I installed all dependencies because I have already compiled about 4 coin source codes.

But with this particular source I am getting build errors, I will copy and paste the errors from the command line.

So I typed in

```
make -f makefile.unix USE_QRCODE=1  

the here is the results.
  -MMD -MF obj/key.d -o obj/key.o key.cpp

key.cpp:30:5: error: ‘secp256k1_context_t’ does not name a type
     secp256k1_context_t* ctx;
     ^
key.cpp: In constructor ‘{anonymous}::CSecp256k1Init::CSecp256k1Init()’:

key.cpp:32:9: error: ‘ctx’ was not declared in this scope
         ctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN);
         ^
key.cpp: In destructor ‘{anonymous}::CSecp256k1Init::~CSecp256k1Init()’:

key.cpp:35:35: error: ‘ctx’ was not declared in this scope
         secp256k1_context_destroy(ctx);
                                   ^
key.cpp: In member function ‘bool CKey::SetPrivKey(const CPrivKey&, bool)’:

key.cpp:472:61: error: ‘class {anonymous}::CSecp256k1Init’ has no member named ‘ctx’
     if (!secp256k1_ec_privkey_import(instance_of_csecp256k1.ctx, (unsigned char*)begin(), &privkey[0], privkey.size()))
                                                             ^
key.cpp:472:118: error: ‘secp256k1_ec_privkey_import’ was not declared in this scope
     if (!secp256k1_ec_privkey_import(instance_of_csecp256k1.ctx, (unsigned char*)begin(), &privkey[0], privkey.size()))
                                                                                                                      ^
key.cpp: In member function ‘CPrivKey CKey::GetPrivKey() const’:

key.cpp:491:66: error: ‘class {anonymous}::CSecp256k1Init’ has no member named ‘ctx’
     int ret = secp256k1_ec_privkey_export(instance_of_csecp256k1.ctx, begin(), (unsigned char*)&privkey[0], &privkeylen, fCompressed);
                                                                  ^
key.cpp:491:133: error: ‘secp256k1_ec_privkey_export’ was not declared in this scope
     int ret = secp256k1_ec_privkey_export(instance_of_csecp256k1.ctx, begin(), (unsigned char*)&privkey[0], &privkeylen, fCompressed);
                                                                                                                                     ^
key.cpp: In member function ‘CPubKey CKey::GetPubKey() const’:

key.cpp:507:65: error: ‘class {anonymous}::CSecp256k1Init’ has no member named ‘ctx’
     int ret = secp256k1_ec_pubkey_create(instance_of_csecp256k1.ctx, (unsigned char*)pubkey.begin(), &clen, begin(), fCompressed);
                                                                 ^
key.cpp: In member function ‘bool CKey::Sign(const uint256&, std::vector<unsigned char>&) const’:

key.cpp:529:57: error: ‘class {anonymous}::CSecp256k1Init’ has no member named ‘ctx’
         if (secp256k1_ecdsa_sign(instance_of_csecp256k1.ctx, hash.begin(), (unsigned char*)&vchSig[0], &nSigLen, begin(),  secp256k1_nonce_function_rfc6979, NULL))
                                                         ^
key.cpp: In member function ‘bool CKey::SignCompact(const uint256&, std::vector<unsigned char>&) const’:

key.cpp:553:75: error: ‘class {anonymous}::CSecp256k1Init’ has no member named ‘ctx’
         if (int ret = secp256k1_ecdsa_sign_compact(instance_of_csecp256k1.ctx, hash.begin(), &vchSig[1], begin(), secp256k1_nonce_function_rfc6979, NULL, &rec))
                                                                           ^
key.cpp:553:159: error: ‘secp256k1_ecdsa_sign_compact’ was not declared in this scope
         if (int ret = secp256k1_ecdsa_sign_compact(instance_of_csecp256k1.ctx, hash.begin(), &vchSig[1], begin(), secp256k1_nonce_function_rfc6979, NULL, &rec))
                                                                                                                                                               ^

key.cpp:553:17: warning: unused variable ‘ret’ [-Wunused-variable]
         if (int ret = secp256k1_ecdsa_sign_compact(instance_of_csecp256k1.ctx, hash.begin(), &vchSig[1], begin(), secp256k1_nonce_function_rfc6979, NULL, &rec))
                 ^

key.cpp: In member function ‘bool CKey::Load(CPrivKey&, CPubKey&, bool)’:

key.cpp:569:61: error: ‘class {anonymous}::CSecp256k1Init’ has no member named ‘ctx’
     if (!secp256k1_ec_privkey_import(instance_of_csecp256k1.ctx, (unsigned char*)begin(), &privkey[0], privkey.size()))
                                                             ^

key.cpp:569:118: error: ‘secp256k1_ec_privkey_import’ was not declared in this scope
     if (!secp256k1_ec_privkey_import(instance_of_csecp256k1.ctx, (unsigned char*)begin(), &privkey[0], privkey.size()))
                                                                                                                      ^
key.cpp: In member function ‘bool CPubKey::VerifyCompact(const uint256&, const std::vector<unsigned char>&) const’:

key.cpp:633:10: warning: unused variable ‘fComp’ [-Wunused-variable]
     bool fComp = IsCompressed();
          ^

key.cpp: In member function ‘bool CPubKey::IsFullyValid() const’:

key.cpp:655:60: error: ‘class {anonymous}::CSecp256k1Init’ has no member named ‘ctx’
     if (!secp256k1_ec_pubkey_verify(instance_of_csecp256k1.ctx, begin(), size()))
                                                            ^

key.cpp:655:80: error: ‘secp256k1_ec_pubkey_verify’ was not declared in this scope
     if (!secp256k1_ec_pubkey_verify(instance_of_csecp256k1.ctx, begin(), size()))
                                                                                ^

key.cpp: In member function ‘bool CPubKey::Decompress()’:

key.cpp:670:69: error: ‘class {anonymous}::CSecp256k1Init’ has no member named ‘ctx’

int ret = secp256k1_ec_pubkey_decompress(instance_of_csecp256k1.ctx, (unsigned char*)begin(), &clen);
                                                                     ^
key.cpp:670:104: error: ‘secp256k1_ec_pubkey_decompress’ was not declared in this scope

int ret = secp256k1_ec_pubkey_decompress(instance_of_csecp256k1.ctx, (unsigned char*)begin(), &clen);
                                                                                                        ^
key.cpp: In member function ‘bool CKey::Derive(CKey&, unsigned char*, unsigned int, const unsigned char*) const’:

key.cpp:712:70: error: ‘class {anonymous}::CSecp256k1Init’ has no member named ‘ctx’

bool ret = secp256k1_ec_privkey_tweak_add(instance_of_csecp256k1.ctx, (unsigned char*)keyChild.begin(), out);
                                                                      ^
key.cpp: In member function ‘bool CPubKey::Derive(CPubKey&, unsigned char*, unsigned int, const unsigned char*) const’:

key.cpp:731:69: error: ‘class {anonymous}::CSecp256k1Init’ has no member named ‘ctx’
     bool ret = secp256k1_ec_pubkey_tweak_add(instance_of_csecp256k1.ctx, (unsigned char*)pubkeyChild.begin(), pubkeyChild.size(), out);
                                                                     ^

makefile.unix:206: recipe for target 'obj/key.o' failed

make: *** [obj/key.o] Error 1

```

I have been trying to debug but I cant seem to get anywhere, can someone please help me out?

Thanks.

**Tags:** altcoin, ubuntu, make

> **Comments:**
> **username_1**: Try downloading and compiling this: https://github.com/bitcoin-core/secp256k1  
> **username_0**: I did that before I tried running the makefile.  
> **username_0**: Does it need to be included into the system environment? And if it does what specific file needs to be included?  

---

## 1 answers

### Answer by username_2 on 2017-10-31. Score: -1

1) Make new folders called `obj` and `obj-test` inside the `src` folder

2) Try to recompile


---

