The Crystal Programming Language Forum

Trouble with building shard

Hello, just started on Crystal 2 days ago. I have finished the tutorial and i decided i would like to try to learn shards as the next thing. But when i run “shards build” and check my bin folder i get no files? anyone who knows why this might happen? here is the code:
main.cr

require "ncurses"

NCurses.open do
  # initialize
  NCurses.cbreak
  NCurses.noecho
  NCurses.start_color

  # Define background color
  pair = NCurses::ColorPair.new(1).init(NCurses::Color::RED, NCurses::Color::BL$
  NCurses.bkgd(pair)

  NCurses.erase

  # move the cursor
  NCurses.move(x: 0, y: 1)
  # longname returns the verbose description of the current terminal
  NCurses.addstr(NCurses.longname)
  NCurses.move(x: 0, y: 2)
  NCurses.addstr(NCurses.curses_version)

  NCurses.move(y: 10, x: 20)
  NCurses.addstr("Hello, world!")
  NCurses.refresh

  NCurses.notimeout(true)
  NCurses.getch
end

shard.yml:

name: NCurses_testing
version: 0.1.0

# authors:
#   - name <email@example.com>

# description: |
#   Short description of NCurses_testing

dependencies:
  ncurses:
    github: agatan/ncurses.cr
  pg:
    github: will/crystal-pg
    version: "~> 0.5"
# development_dependencies:
#   webmock:
#     github: manastech/webmock.cr

# license: MIT

shards build can’t build anything if you have no targets specified. It should probably fail, though, in that case.

See documentation on targets property in shard.yml manpage for instructions.

1 Like

thanks for your fast reply. Just what i needed to make it work. :slight_smile:

1 Like