compiling errors

Hello, I'm new to running programs in the command line. I need to run the c++ program at this github:
https://github.com/moneroexamples/mymonero-simplewallet
I'll save some room by not posting the program; you can copy the code from the github link, if you need it.
When I tried to compile the program, I got a slew of errors, some of which you can see below in the code window. I couldn't post them all because it exceeds the posting character limit. I'm not really sure of what they mean, and I'd appreciate a little help getting this program to compile.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
a@a-1000H:~$ g++ mym2swt.cpp
mym2swt.cpp: In function ‘int main(int, const char**)’:
mym2swt.cpp:4:5: error: ‘xmreg’ has not been declared
     xmreg::CmdLineOptions opts {ac, av};
     ^
mym2swt.cpp:4:27: error: expected ‘;’ before ‘opts’
     xmreg::CmdLineOptions opts {ac, av};
                           ^
mym2swt.cpp:6:10: error: ‘help_opt’ does not name a type
     auto help_opt = opts.get_option<bool>("help");
          ^
mym2swt.cpp:9:10: error: ‘help_opt’ was not declared in this scope
     if (*help_opt)
          ^
mym2swt.cpp:16:5: error: ‘string’ was not declared in this scope
     string language {"English"};
     ^
mym2swt.cpp:16:12: error: expected ‘;’ before ‘language’
     string language {"English"};
            ^
mym2swt.cpp:19:10: error: ‘mnemonic_opt’ does not name a type
     auto mnemonic_opt = opts.get_option<string>("mnemonic");
          ^
mym2swt.cpp:20:10: error: ‘wallet_file_opt’ does not name a type
     auto wallet_file_opt = opts.get_option<string>("wallet-file");
          ^
mym2swt.cpp:21:10: error: ‘password_opt’ does not name a type
     auto password_opt = opts.get_option<string>("password");
          ^
mym2swt.cpp:25:12: error: expected ‘;’ before ‘mnemonic_str’
     string mnemonic_str = mnemonic_opt
            ^
mym2swt.cpp:33:12: error: expected ‘;’ before ‘wallet_file’
     string wallet_file = wallet_file_opt
            ^
mym2swt.cpp:38:12: error: expected ‘;’ before ‘keys_file_name’
     string keys_file_name = wallet_file + string(".keys");
            ^
mym2swt.cpp:40:12: error: expected ‘;’ before ‘password’
     string password = password_opt ? *password_opt : "password";
            ^
mym2swt.cpp:42:5: error: ‘cout’ was not declared in this scope
     cout << "\n"
     ^
mym2swt.cpp:43:38: error: ‘mnemonic_str’ was not declared in this scope
          << "Mnemonic seed    : " << mnemonic_str << endl;
                                      ^
mym2swt.cpp:43:54: error: ‘endl’ was not declared in this scope
          << "Mnemonic seed    : " << mnemonic_str << endl;
                                                      ^
mym2swt.cpp:48:5: error: ‘xmreg’ has not been declared
     xmreg::secret_key16 hexadecimal_seed;
     ^
mym2swt.cpp:48:25: error: expected ‘;’ before ‘hexadecimal_seed’
     xmreg::secret_key16 hexadecimal_seed;
                         ^
mym2swt.cpp:51:5: error: ‘xmreg’ has not been declared
     xmreg::ElectrumWords::words_to_bytes(mnemonic_str, hexadecimal_seed, language);
     ^
mym2swt.cpp:51:56: error: ‘hexadecimal_seed’ was not declared in this scope
     xmreg::ElectrumWords::words_to_bytes(mnemonic_str, hexadecimal_seed, language);
                                                        ^
mym2swt.cpp:51:74: error: ‘language’ was not declared in this scope
     xmreg::ElectrumWords::words_to_bytes(mnemonic_str, hexadecimal_seed, language);
                                                                          ^
mym2swt.cpp:60:5: error: ‘crypto’ has not been declared
     crypto::hash hash_of_seed;
     ^
mym2swt.cpp:60:18: error: expected ‘;’ before ‘hash_of_seed’
     crypto::hash hash_of_seed;
                  ^
mym2swt.cpp:62:72: error: ‘hash_of_seed’ was not declared in this scope
     cn_fast_hash(hexadecimal_seed.data, sizeof(hexadecimal_seed.data), hash_of_seed);
                                                                        ^
mym2swt.cpp:62:84: error: ‘cn_fast_hash’ was not declared in this scope
     cn_fast_hash(hexadecimal_seed.data, sizeof(hexadecimal_seed.data), hash_of_seed);
                                                                                    ^
mym2swt.cpp:72:5: error: ‘crypto’ has not been declared
     crypto::public_key public_spend_key;
     ^
mym2swt.cpp:72:24: error: expected ‘;’ before ‘public_spend_key’
     crypto::public_key public_spend_key;
                        ^
mym2swt.cpp:73:5: error: ‘crypto’ has not been declared
     crypto::secret_key private_spend_key;
     ^
mym2swt.cpp:73:24: error: expected ‘;’ before ‘private_spend_key’
     crypto::secret_key private_spend_key;
                        ^
mym2swt.cpp:75:5: error: ‘crypto’ has not been declared
     crypto::generate_keys(public_spend_key, private_spend_key,
     ^
mym2swt.cpp:75:27: error: ‘public_spend_key’ was not declared in this scope
     crypto::generate_keys(public_spend_key, private_spend_key,
                           ^
mym2swt.cpp:75:45: error: ‘private_spend_key’ was not declared in this scope
     crypto::generate_keys(public_spend_key, private_spend_key,
                                             ^
mym2swt.cpp:76:27: error: ‘xmreg’ has not been declared
                           xmreg::get_key_from_hash<crypto::secret_key>(hash_of_seed),
                           ^
mym2swt.cpp:76:52: error: ‘crypto’ has not been declared
                           xmreg::get_key_from_hash<crypto::secret_key>(hash_of_seed),
                                                    ^
mym2swt.cpp:85:5: error: ‘crypto’ has not been declared
     crypto::hash hash_of_hash;
     ^
mym2swt.cpp:85:18: error: expected ‘;’ before ‘hash_of_hash’
     crypto::hash hash_of_hash;
                  ^
mym2swt.cpp:86:64: error: ‘hash_of_hash’ was not declared in this scope
     cn_fast_hash(hash_of_seed.data, sizeof(hash_of_seed.data), hash_of_hash);
                                                                ^
mym2swt.cpp:88:5: error: ‘crypto’ has not been declared
     crypto::public_key public_view_key;
     ^
mym2swt.cpp:88:24: error: expected ‘;’ before ‘public_view_key’
     crypto::public_key public_view_key;
                        ^
mym2swt.cpp:89:5: error: ‘crypto’ has not been declared
     crypto::secret_key private_view_key;
     ^
mym2swt.cpp:89:24: error: expected ‘;’ before ‘private_view_key’
     crypto::secret_key private_view_key;
                        ^
mym2swt.cpp:92:5: error: ‘crypto’ has not been declared
     crypto::generate_keys(public_view_key, private_view_key,
     ^
mym2swt.cpp:92:27: error: ‘public_view_key’ was not declared in this scope
     crypto::generate_keys(public_view_key, private_view_key,
                           ^
mym2swt.cpp:92:44: error: ‘private_view_key’ was not declared in this scope
     crypto::generate_keys(public_view_key, private_view_key,
                                            ^
mym2swt.cpp:93:27: error: ‘xmreg’ has not been declared
                           xmreg::get_key_from_hash<crypto::secret_key>(hash_of_hash),
                           ^
mym2swt.cpp:93:52: error: ‘crypto’ has not been declared
                           xmreg::get_key_from_hash<crypto::secret_key>(hash_of_hash),
                                                    ^
mym2swt.cpp:103:5: error: ‘cryptonote’ has not been declared
     cryptonote::account_public_address address {public_spend_key, public_view_key};
     ^
mym2swt.cpp:103:40: error: expected ‘;’ before ‘address’
     cryptonote::account_public_address address {public_spend_key, public_view_key};
                                        ^
mym2swt.cpp:107:38: error: ‘address’ was not declared in this scope
          << "Monero address   : " << address << endl;
                                      ^
mym2swt.cpp:118:5: error: ‘xmreg’ has not been declared
     xmreg::simple_account account;
     ^
mym2swt.cpp:118:27: error: expected ‘;’ before ‘account’
     xmreg::simple_account account;
Last edited on
file:///home/a/Desktop/crypto_stuff/Monero/mymonerotosimplewallet.html

That's not a github link. That's a file on your hard drive.

Anyway, the first error:
‘xmreg’ has not been declared
This indicates that somewhere there is a namespace xmreg, and whatever header it's in hasn't been included.
Some obvious errors:
Line 4,51-64,99-103: You haven't included the declaration for xmreg.

Line 9,22-28: auto requires C++11. Have you enabled C++11 syntax?

Line 15-19,31-40: You haven't included the header for <string>.

Line 42-49: Have you included the header for <iostream>?

Line 57-64: You haven't included the declaration for class ElectrumWords.

Line 66-70,78-97,114-133: You haven't included the declaration for class crypto.

You should get the idea by now.



I corrected the original post to include the github link.
On closer reading of the github, the program that I am compiling probably needs the header files and libraries for another program called Monero. Link to Monero's compilation insructions:
https://github.com/moneroexamples/compile-monero-09-on-ubuntu
The Monero github also lists dependencies for Ubuntu 14.04. I have a machine with 14.04.
I'll get the headers, libraries and dependencies and report the results of my next attempt at compiling.
Last edited on
Also,


g++ mym2swt.cpp

This only compiles one of the cpp files, you have a bunch of them on gitub - need to compile all of them? Or is this part of the output from a make command?

Compile with a high level of warnings turned on, at a minimum:

g++ -std=c++14 -Wall -Wextra -pedantic-errors *.cpp -o mym2swt

Despite those options, there are still some warnings not turned on, there are some more handy ones here:
http://www.cplusplus.com/forum/general/183731/#msg899203

Hopefully you can set these warnings options in your IDE somewhere, or in the makefile if it is not auto generated.

Edit:

Try to get hold of clang++ , it's better than g++ IMO. http://llvm.org/
Last edited on
I found some instructions at the bottom of the page that I didn't see before:

# download the source code
git clone https://github.com/moneroexamples/mymonero-simplewallet.git

# enter the downloaded sourced code folder
cd mymonero-simplewallet

# create the makefile
cmake .

# compile
make

I got this

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
a@a-1000H:~/mymonero-simplewallet$ cmake .
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Boost version: 1.55.0
-- Found the following Boost libraries:
--   system
--   filesystem
--   thread
--   date_time
--   chrono
--   regex
--   serialization
--   program_options
-- Configuring done
-- Generating done
-- Build files have been written to: /home/a/mymonero-simplewallet
a@a-1000H:~/mymonero-simplewallet$ make
Scanning dependencies of target myxrm
[ 16%] Building CXX object src/CMakeFiles/myxrm.dir/MicroCore.cpp.o
In file included from /home/a/mymonero-simplewallet/src/MicroCore.h:10:0,
                 from /home/a/mymonero-simplewallet/src/MicroCore.cpp:5:
/home/a/mymonero-simplewallet/src/monero_headers.h:11:46: fatal error: cryptonote_core/cryptonote_basic.h: No such file or directory
 #include "cryptonote_core/cryptonote_basic.h"
                                              ^
compilation terminated.
make[2]: *** [src/CMakeFiles/myxrm.dir/MicroCore.cpp.o] Error 1
make[1]: *** [src/CMakeFiles/myxrm.dir/all] Error 2
make: *** [all] Error 2
a@a-1000H:~/mymonero-simplewallet$ ls
CMakeCache.txt  CMakeFiles  cmake_install.cmake  CMakeLists.txt  img  main.cpp  Makefile  README.md  src
a@a-1000H:~/mymonero-simplewallet$ ls -a
.   CMakeCache.txt  cmake_install.cmake  .git        img       Makefile   src
..  CMakeFiles      CMakeLists.txt       .gitignore  main.cpp  README.md
a@a-1000H:~/mymonero-simplewallet$ ./main.cpp
bash: ./main.cpp: Permission denied
a@a-1000H:~/mymonero-simplewallet$ sudo ./main.cpp
[sudo] password for a: 
sudo: ./main.cpp: command not found
a@a-1000H:~/mymonero-simplewallet$ 


They say, "After this, mymonerowallet executable file should be present in the mymonero-simplewallet folder." What am I doing wrong?

Keep in mind, I might not understand the lingo. I have no idea what a makefile is, or most of the other stuff we're talking about.
The error message says:

/home/a/mymonero-simplewallet/src/monero_headers.h:11:46: fatal error: cryptonote_core/cryptonote_basic.h: No such file or directory
 #include "cryptonote_core/cryptonote_basic.h"

Do you have that header file in your path? Is that part of some other library/framework that you also need to download?
Topic archived. No new replies allowed.