circle icon indicating copy to clipboard operation
circle copied to clipboard

Fail to compile the simple `inject2.cxx` example

Open Karbo123 opened this issue 2 years ago • 0 comments

The latest build (i.e. build_170) fails to compile the simple inject2.cxx example, I don't know whether it has been fully tested before releasing, or it is just my environment problem.

To reproduce:

# set up
wget https://www.circle-lang.org/linux/build_170.tgz
tar -xvzf build_170.tgz
export PATH=$PATH:`pwd`

# prepare codes
git clone [email protected]:seanbaxter/circle.git --depth=1
cd circle/new_whitepaper
circle inject2.cxx

It raises errors:

Injecting sq = x * x
Injecting unity = sq(sin(x)) + sq(cos(x))
macro expansion: @mvoid inject_from_json(const char*)
error in expansion of macro @mvoid inject_from_json(const char*)
inject2.cxx:37:46
  @macro namespace(injected) inject_from_json("inject.json"); 
                                             ^
  macro expansion: @mvoid inject_function(std::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::basic_string<char, std::char_traits<char>, std::allocator<char>>)
  error in expansion of macro @mvoid inject_function(std::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::basic_string<char, std::char_traits<char>, std::allocator<char>>)
  inject2.cxx:30:27
      @macro inject_function(key, value); 
                            ^
    code injection: inject2.cxx:12:12
    error thrown in @@expression("x * x")
        return @@expression(text); 
               ^
      error: <inject2.cxx:12:12>:1:1
      undeclared identifier 'x'
      x * x
      ^
  macro expansion: @mvoid inject_function(std::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::basic_string<char, std::char_traits<char>, std::allocator<char>>)
  error in expansion of macro @mvoid inject_function(std::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::basic_string<char, std::char_traits<char>, std::allocator<char>>)
  inject2.cxx:30:27
      @macro inject_function(key, value); 
                            ^
    code injection: inject2.cxx:12:12
    error thrown in @@expression("sq(sin(x)) + sq(cos(x))")
        return @@expression(text); 
               ^
      error: <inject2.cxx:12:12>:1:8
      undeclared identifier 'x'
      sq(sin(x)) + sq(cos(x))
             ^

error: inject2.cxx:39:42
'unity' is not a member of namespace injected
  std::cout<< "unity(.3) = "<< injected::unity(.3)<< "\n"; 

Karbo123 avatar Jun 28 '22 13:06 Karbo123