1

I tried the hello world sample contract, and when it came time to compile, I got this error:

hello.cpp:10:10: error: expected ']'
                [[eosio:action]]
                       ^
                       ]
hello.cpp:10:5: warning: unknown attribute 'eosio' ignored [-Wunknown-attributes]
                [[eosio:action]]
                  ^
1 warning and 1 error generated.

I fixed it by using the GNU-style attribute syntax mentioned here. However, I'd like to stick to the intended C++11 syntax, or at least know what the tradeoffs are for using the GNU syntax. If I follow the C++11 syntax, I'm supposing I need to upgrade my compiler to accept C++11 syntax? Or am I barking up the wrong tree?

1 Answer 1

1

To use this syntax, you need to be compiling with the latest version of eosio.cdt. When you build and compile eosio.cdt, it will install the appropriate clang compiler for you, and eosio-cpp will be called with all of the appropriate flags.

Also, in your particular case, your attributes are missing a colon, it should say [[eosio::action]], not [[eosio:action]].

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.