eosnewyork / eoseasycontract Goto Github PK
View Code? Open in Web Editor NEWTooling to help developers create smart contracts easily
Tooling to help developers create smart contracts easily
I'm doing some testing with compiling contracts and I'm unable to compile the EOSIO Hello World contract. It's not able to find the type account_name
#include <eosiolib/eosio.hpp>
#include <eosiolib/print.hpp>
using namespace eosio;
class hello : public eosio::contract {
public:
using contract::contract;
[[eosio::action]]
void hi(account_name user) {
print ("Hello, ", name{user});
}
}
EOSIO_ABI(hello, (hi))
HelloWorld.cpp:10:11: error: unknown type name 'account_name'
void hi(account_name user) {
Two other compile errors:
HelloWorld.cpp:15:19: error: C++ requires a type specifier for all declarations
EOSIO_ABI(hello, (hi))
HelloWorld.cpp:15:23: error: expected function body after function declarator
EOSIO_ABI(hello, (hi))
Hi,
I am new to Eos (iam using jungle Testnet ). i have tried a small contract which given below. adding two number
and result storing in a variable c.after deploying the contract. passing a two argument to contract
function.
how do i access the variable c (which is result). if not is there is any other way to access result.
#include <eosiolib/eosio.hpp>
#include <eosiolib/print.hpp>
using namespace eosio;
class add : public contract
{
public:
uint64_t c;
using contract::contract;
void sum(uint64_t a, uint64_t b)
{
c = a + b;
print("Sum is ",c);
}
void gdata()
{
print(c);
}
};
EOSIO_DISPATCH(add, (sum) (gdata))
Revisited your work on EOSEasyContract today :), upgraded the binaries and found my old project didn't compile anymore. Created a new project using EOSEasyContract.exe template new --path C:\Work\EOSIO\Projects --name EOSTemplate4
, opened in VS Code, ran Ctrl+Shift+B and the compilation was successful (see below).
> Executing task: EOSEasyContract.exe build --path "C:\Work\EOSIO\Projects\EOSTemplate4" --watch <
Begin watching C:\Work\EOSIO\Projects\EOSTemplate4. Build using docker image binaryfocus/eosio_wasm_1.5.1.
Begin EOSIO contract build
Building ...
Check if container EOSCDT-1118910928BD38CC125B186580F38A20 exists
No existing container found
Creating container EOSCDT-1118910928BD38CC125B186580F38A20 from image binaryfocus/eosio_wasm_1.5.1
AttachContainerAsync: EOSCDT-1118910928BD38CC125B186580F38A20
StartContainerAsync: EOSCDT-1118910928BD38CC125B186580F38A20
ExecCreateContainerAsync 1594e1906a3b1342f0d633b50881f9538140bccd15633966272a9398812ed4b4
=========== BEGIN: Building Contract ===========
-- The C compiler identification is Clang 4.0.1
-- The CXX compiler identification is Clang 4.0.1
-- Check for working C compiler: /usr/bin/clang
-- Check for working C compiler: /usr/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/clang++
-- Check for working CXX compiler: /usr/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Setting up Eosio Wasm Toolchain 1.4.1 at /usr/local/eosio.cdt
-- Configuring done
-- Generating done
-- Build files have been written to: build
Scanning dependencies of target EOSTemplate4.wasm
[ 50%] Building CXX object CMakeFiles/EOSTemplate4.wasm.dir/EOSTemplate4.cpp.o
Warning, empty ricardian clause file
Warning, empty ricardian clause file
Warning, action <hi> does not have a ricardian contract
[100%] Linking CXX executable EOSTemplate4.wasm
[100%] Built target EOSTemplate4.wasm
=========== END: Building Contract ===========
End EOSIO contract build
Done Building. Build Duration = 00:00:14.4230063
Did a Ctrl+S to trigger the build again and it now fails.
Begin EOSIO contract build
Building ...
Check if container EOSCDT-1118910928BD38CC125B186580F38A20 exists
Existing container found
ExecCreateContainerAsync 4becf8cac8d66f385fff85ac625fd20fff23ed2aab73b73c63b6293756038710
=========== BEGIN: Building Contract ===========
-- Setting up Eosio Wasm Toolchain 1.4.1 at /usr/local/eosio.cdt
-- Configuring done
You have changed variables that require your cache to be deleted.
Configure will be re-run and you may have to reset some variables.
The following variables have changed:
CMAKE_C_COMPILER= /usr/local/eosio.cdt/bin/eosio-cc
CMAKE_CXX_COMPILER= /usr/local/eosio.cdt/bin/eosio-cpp
-- The C compiler identification is Clang 7.0.0
-- The CXX compiler identification is Clang 7.0.0
-- Check for working C compiler: /usr/local/eosio.cdt/bin/eosio-cc
-- Check for working C compiler: /usr/local/eosio.cdt/bin/eosio-cc -- broken
CMake Error at /usr/local/share/cmake-3.9/Modules/CMakeTestCCompiler.cmake:51 (message):
The C compiler "/usr/local/eosio.cdt/bin/eosio-cc" is not able to compile a
simple test program.
It fails with the following output:
Change Dir: build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_555d1/fast"
/usr/bin/make -f CMakeFiles/cmTC_555d1.dir/build.make
CMakeFiles/cmTC_555d1.dir/build
make[1]: Entering directory 'build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_555d1.dir/testCCompiler.c.o
/usr/local/eosio.cdt/bin/eosio-cc -o
CMakeFiles/cmTC_555d1.dir/testCCompiler.c.o -c
build/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_555d1
/usr/local/bin/cmake -E cmake_link_script
CMakeFiles/cmTC_555d1.dir/link.txt --verbose=1
/usr/local/eosio.cdt/bin/eosio-cc
CMakeFiles/cmTC_555d1.dir/testCCompiler.c.o -o cmTC_555d1
clang-7: warning: CMakeFiles/cmTC_555d1.dir/testCCompiler.c.o: 'linker'
input unused [-Wunused-co
mmand-line-argument]
clang-7: warning: argument unused during compilation: '-ffreestanding'
[-Wunused-command-line-argument]
clang-7: warning: argument unused during compilation: '-fno-builtin'
[-Wunused-command-line-argument]
clang-7: warning: argument unused during compilation:
'-fno-threadsafe-statics' [-Wunused-command-line-argument]
clang-7: warning: argument unused during compilation: '-D
BOOST_DISABLE_ASSERTS' [-Wunused-command-line-argument]
clang-7: warning: argument unused during compilation: '-D
BOOST_EXCEPTION_DISABLE' [-Wunused-command-line-argument]
clang-7: warning: argument unused during compilation: '-Xclang -load'
[-Wunused-command-line-argument]
clang-7: warning: argument unused during compilation: '-Xclang
/usr/local/eosio.cdt/bin/LLVMEosioApply.so'
[-Wunused-command-line-argument]
clang-7: warning: argument unused during compilation:
'-fplugin=/usr/local/eosio.cdt/bin/eosio_plugin.so'
[-Wunused-command-line-argument]
clang-7: warning: argumen
t unused during compilation: '-mllvm
-use-cfl-aa-in-codegen=both' [-Wunused-command-line-argument]
clang-7: warning: argument unused during compilation: '-I
/usr/local/eosio.cdt/bin/../include/libcxx'
[-Wunused-command-line-argument]
clang-7: warning: argument unused during compilation: '-I
/usr/local/eosio.cdt/bin/../include/libc' [-Wunused-command-line-argument]
clang-7: warning: argument unused during compilation: '-I
/usr/local/eosio.cdt/bin/../include' [-Wunused-command-line-argument]
clang-7: warning: argument unused during compilation: '-O3'
[-Wunused-command-line-argument]
CMakeFiles/cmTC_555d1.dir/build.make:97: recipe for target 'cmTC_555d1'
failed
make[1]: *** [cmTC_555d1] Error 255
make[1]: Leaving directory 'build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_555d1/fast' failed
make: *** [cmTC_555d1/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2
(project)
-- Configuring incomplete, errors occurred!
See also "build/CMakeFiles/CMakeOutput.log".
See also "build/CMakeFiles/CMakeError.log".
-- The C compiler identification is Clang 7.0.0
-- The CXX compiler identification is Clang 7.0.0
-- Check for working C compiler: /usr/local/eosio.cdt/bin/eosio-cc
-- Check for working C compiler: /usr/local/eosio.cdt/bin/eosio-cc -- broken
CMake Error at /usr/local/share/cmake-3.9/Modules/CMakeTestCCompiler.cmake:51 (message):
The C compiler "/usr/local/eosio.cdt/bin/eosio-cc" is not able to compile a
simple test program.
It fails with the following output:
Change Dir: build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_c4eea/fast"
make[1]: Entering directory 'build/CMakeFiles/CMakeTmp'
/usr/bin/make -f CMakeFiles/cmTC_c4eea.dir/build.make
CMakeFiles/cmTC_c4eea.dir/build
make[2]: Entering directory 'build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_c4eea.dir/testCCompiler.c.o
/usr/local/eosio.cdt/bin/eosio-cc -o
CMakeFiles/cmTC_c4eea.dir/testCCompiler.c.o -c
build/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_c4eea
/usr/local/bin/cmake -E cmake_link_script
CMakeFiles/cmTC_c4eea.dir/link.txt --verbose=1
/usr/local/eosio.cdt/bin/eosio-cc
CMakeFiles/cmTC_c4eea.dir/testCCompiler.c.o -o cmTC_c4eea
clang-7: warning: CMakeFiles/cmTC_
c4eea.dir/testCCompiler.c.o: 'linker'
input unused [-Wunused-command-line-argument]
clang-7: warning: argument unused during compilation: '-ffreestanding'
[-Wunused-command-line-argument]
clang-7: warning: argument unused during compilation: '-fno-builtin'
[-Wunused-command-line-argument]
clang-7: warning: argument unused during compilation:
'-fno-threadsafe-statics' [-Wunused-command-line-argument]
clang-7: warning: argument unused during compilation: '-D
BOOST_DISABLE_ASSERTS' [-Wunused-command-line-argument]
clang-7: warning: argument unused during compilation: '-D
BOOST_EXCEPTION_DISABLE' [-Wunused-command-line-argument]
clang-7: warning: argument unused during compilation: '-Xclang -load'
[-Wunused-command-line-argument]
clang-7: warning: argument unused during compilation: '-Xclang
/usr/local/eosio.cdt/bin/LLVMEosioApply.so'
[-Wunused-command-line-argument]
clang-7: warning: argument unused during compilation:
'-fplugin=/usr/local/eosio.cdt/bin/eosio_plugin.so
'
[-Wunused-command-line-argument]
clang-7: warning: argument unused during compilation: '-mllvm
-use-cfl-aa-in-codegen=both' [-Wunused-command-line-argument]
clang-7: warning: argument unused during compilation: '-I
/usr/local/eosio.cdt/bin/../include/libcxx'
[-Wunused-command-line-argument]
clang-7: warning: argument unused during compilation: '-I
/usr/local/eosio.cdt/bin/../include/libc' [-Wunused-command-line-argument]
clang-7: warning: argument unused during compilation: '-I
/usr/local/eosio.cdt/bin/../include' [-Wunused-command-line-argument]
clang-7: warning: argument unused during compilation: '-O3'
[-Wunused-command-line-argument]
CMakeFiles/cmTC_c4eea.dir/build.make:97: recipe for target 'cmTC_c4eea'
failed
make[2]: *** [cmTC_c4eea] Error 255
make[2]: Leaving directory 'build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_c4eea/fast' failed
make[1]: *** [cmTC_c4eea/fast] Error 2
make[1]: Leaving directory 'build/CMakeFiles/CMak
eTmp'
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)
-- Configuring incomplete, errors occurred!
See also "build/CMakeFiles/CMakeOutput.log".
See also "build/CMakeFiles/CMakeError.log".
Makefile:176: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
=========== END: Building Contract ===========
End EOSIO contract build
Done Building. Build Duration = 00:00:04.2739030
Looks like the CMakeCache.txt file is created with different values from the initial build.
//cxx
CMAKE_CXX_COMPILER:PATH=/usr/local/eosio.cdt/bin/eosio-cpp
//LLVM archiver
CMAKE_CXX_COMPILER_AR:FILEPATH=/usr/local/eosio.cdt/bin/llvm-ar
//Generate index for LLVM archive
CMAKE_CXX_COMPILER_RANLIB:FILEPATH=/usr/local/eosio.cdt/bin/llvm-ranlib
//cc
CMAKE_C_COMPILER:PATH=/usr/local/eosio.cdt/bin/eosio-cc
//LLVM archiver
CMAKE_C_COMPILER_AR:FILEPATH=/usr/local/eosio.cdt/bin/llvm-ar
//Generate index for LLVM archive
CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/local/eosio.cdt/bin/llvm-ranlib
Make sure that you when you generate new templates, you execute the command from the install folder or you'll get an error that looks as follows.
C:\Users\Admin>EOSEasyContract.exe template new --path c:\temp --name EOSTemplate1
Begin create of new smart contract EOSTemplate1 in parent folder c:\temp
Create new smart contract template "EOSTemplate1" in "c:\temp\EOSTemplate1"
Creatind directory "c:\temp\EOSTemplate1"
Could not find a part of the path 'C:\Users\Admin\templateFiles\build.sh'.
Executing from c:\tools\EOSEasyContract or wherever you installed the binaries will correct the problem.
c:\tools\EOSEasyContract>EOSEasyContract.exe template new --path c:\temp --name EOSTemplate1
Begin create of new smart contract EOSTemplate1 in parent folder c:\temp
Create new smart contract template "EOSTemplate1" in "c:\temp\EOSTemplate1"
Creatind directory "c:\temp\EOSTemplate1"
Template creation completed
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.