V: Problem with examples

Created on 14 Aug 2020  路  24Comments  路  Source: vlang/v

  1. terminal_control.exe
v-0.1.29\v\examples\terminal_control.exe"
鈫怺2J鈫怺5;5H鈫怺1m鈫怺33m*鈫怺39m鈫怺22m鈫怺5;6H鈫怺1m鈫怺33m*鈫怺39m鈫怺22m鈫怺5;7H鈫怺1m鈫怺33m*鈫怺39m鈫怺22m鈫怺5;8H鈫怺1m鈫怺33m*鈫怺39m鈫怺22m鈫怺5;9H鈫怺1m鈫怺33m*鈫怺39m鈫怺22m鈫怺5;5H鈫怺1m鈫怺33m*鈫怺39m鈫怺22m鈫怺6;5H鈫怺1m鈫怺33m*鈫怺39m鈫怺22m鈫怺7;5H鈫怺1m鈫怺33m*鈫怺39m鈫怺22m鈫怺8;5H鈫怺1m鈫怺33m*鈫怺39m鈫怺22m鈫怺9;5H鈫怺1m鈫怺33m*鈫怺39m鈫怺22m鈫怺10;5H鈫怺1m鈫怺33m*鈫怺39m鈫怺22m鈫怺10;6H鈫怺1m鈫怺33m*鈫怺39m鈫怺22m鈫怺10;7H鈫怺1m鈫怺33m*鈫怺39m鈫怺22m鈫怺10;8H鈫怺1m鈫怺33m*鈫怺39m鈫怺22m鈫怺10;9H鈫怺1m鈫怺33m*鈫怺39m鈫怺22m鈫怺5;9H鈫怺1m鈫怺33m*鈫怺39m鈫怺22m鈫怺6;9H鈫怺1m鈫怺33m*鈫怺39m鈫怺22m鈫怺7;9H鈫怺1m鈫怺33m*鈫怺39m鈫怺22m鈫怺8;9H鈫怺1m鈫怺33m*鈫怺39m鈫怺22m鈫怺9;9H鈫怺1m鈫怺33m*鈫怺39m鈫怺22m鈫怺5B
鈫怺1m鈫怺31mIt Worked!鈫怺39m鈫怺22m

Is this normall?

Bug

Most helpful comment

With V 0.1.29 c599a4c on Windows 10 2004:

  1. Works.
  2. Runes aren't implemented, yet.
  3. Works, no warnings.
  4. Works, no warnings.
  5. path_tracing.v needs updated to the latest changes in V. Shows a lot of warnings, now.
  6. Same as 2.
  7. Works, with one warning (due to recent change in V).
  8. This was with v run log.v... and I still get the same output. Is it supposed to crash?
  9. Works, with one warning (due to recent change in V).
  10. Works, with one warning (due to recent change in V).
  11. Works, with one warning (due to recent change in V).
  12. I got a different error.
  13. Works, with one warning (due to recent change in V).
  14. Works.
  15. Works.
  16. Several errors, but this was for older version of V. New net.http code is in a PR.
  17. Definitely needs updated.
  18. I get the same error.
  19. There is no such file in the examples/gg directory now. Probably because the last vestiges of freetype have been removed.
  20. There is no such file in the examples/gg directory now.
  21. Works.

So, with the latest V, there are some warnings to clean up due to recent V changes, a couple of examples need to be updated (they were just plain written for older versions of V), a few things to update, and one duplication for a feature that isn't implemented, yet. Should probably remove that example until it does.

Not as bad as it looked from the list of things above.

All 24 comments

  1. rune.v
v-0.1.29\v\examples>v run rune.v
rune.v:3:19: error: unknown function: rune
    1 | fn main() {
    2 |     // GRINNING FACE?? => f0 09 98 80
    3 |     grinning_face := rune(0xf09f9880)
      |                      ~~~~~~~~~~~~~~~~
    4 |     println(grinning_face)
    5 |
rune.v:7:19: error: unknown function: rune
    5 |
    6 |     // COMMERCIAL AT@ => 0x40
    7 |     commercial_at := rune(0x40000000)
      |                      ~~~~~~~~~~~~~~~~
    8 |     println(commercial_at)
    9 | }
  1. v run random_ips.v
v run random_ips.v
random_ips.v:2:8: warning: module 'time' is imported but never used
    1 | import rand
    2 | import time
      |        ~~~~
    3 |
    4 | fn main() {
189.219.179.227
62.237.84.186
149.243.49.11
30.41.165.172
163.216.240.246
169.137.67.177
238.133.37.2
33.156.198.227
30.157.4.20
132.200.216.14

4.

v-0.1.29\v\examples>v run quick_sort.v
quick_sort.v:1:8: warning: module 'time' is imported but never used
    1 | import time
      |        ~~~~
    2 | import rand
    3 |
length of random array is 1000
before quick sort whether array is sorted: false
after quick sort whether array is sorted: true
    5.
v-0.1.29\v\examples>v run path_tracing.v
Unhandled Exception 0xC00000FD
print_backtrace_skipping_top_frames is not implemented
  • crashed

7.

v-0.1.29\v\examples>v run news_fetcher.v
Error 10057 sending data to server (1)
Error performing handshake
failed to decode topstories.json

8

Vlang\v-0.1.29\v\examples\info.log after this example crashes.
V panic: info.log: fatal
print_backtrace_skipping_top_frames is not implemented

9.

v-0.1.29\v\examples>v run links_scraper.v
Error 10057 sending data to server (1)
Error performing handshake

10.

v-0.1.29\v\examples>v run fetch.v
Error 10057 sending data to server (1)
Error performing handshake
1969-12-31 00:00

11.

v-0.1.29\v\examples\vweb>v run vweb_example.v
vweb_example.v:38:1: error: vweb HTML template "index.html" not found
   36 |     numbers := [1,2,3]
   37 |     return $vweb.html()
   38 | }
      | ^
   39 |
   40 | pub fn (mut app App) text() vweb.Result {

12.

v-0.1.29\v\examples\database>v run sqlite.v
E:\v-0.1.29\v\thirdparty\sqlite\sqlite3.o not found, building it...
V panic: ls() couldnt open dir "E:\v-0.1.29\v\thirdparty\sqlite": directory does not exist
print_backtrace_skipping_top_frames is not implemented
  1. concurrency.v is ok but:
v-0.1.29\v\examples\concurrency>v run concurrency_http.v
Error 10057 sending data to server (1)
Error performing handshake
EFinish getting time 2589 msr
ro
rUnhandled Exception 0xC0000005
1print_backtrace_skipping_top_frames is not implemented0
057 sending data to server (1)
Error performing handshake
Finish getting ip 2605 ms

Unhandled Exception 0xC0000374
print_backtrace_skipping_top_frames is not implemented

14.

v-0.1.29\v\examples\vcasino>v run vcasino.v
vcasino.v:2:8: warning: module 'time' is imported but never used
    1 | import rand
    2 | import time
      |        ~~~~
    3 | import os
    4 |
  The object of Roulette is to pick the number where the spinning ball will land on the wheel.
   If your number is the good one, you'll get your bet x3.
   If your number is the same color as the ball one, you'll get your bet /2.
   Otherwise, you will lose your bet.

You start the game with 1000 V.

Reminder: odd numbers are red and even are black.
Type the number you want to bet on (between 0 and 49):
2

15.

v-0.1.29\v\examples\sokol>v run fonts.v
loaded font: 114624

When scaling then strange issues in bacground

v_fonts

16.

v-0.1.29\v\examples\pico>v run pico.v
==================
C:\Users\user\AppData\Local\Temp\v\pico.tmp.c: At top level:
C:\Users\user\AppData\Local\Temp\v\pico.tmp.c:459:10: fatal error: sys/socket.h: No such file or directory
 #include <sys/socket.h>
          ^~~~~~~~~~~~~~
compilation terminated.
...
==================
(Use `v -cg` to print the entire error message)

builder error:
==================
C error. This should never happen.

If you were not working with C interop, please raise an issue on GitHub:

https://github.com/vlang/v/issues/new/choose

You can also use #help on Discord: https://discord.gg/vlang

17

v-0.1.29\v\examples\hot_reload>v run graph.v
graph.v:21:16: error: unknown struct: gg.Cfg
   19 | fn main() {
   20 |     glfw.init_glfw()
   21 |     gconfig := gg.Cfg {
      |                   ~~~~~
   22 |             width: size
   23 |             height: size
graph.v:29:26: error: cannot use type `gg.Cfg` as type `gg.Config` in argument 1 to `gg.new_context`
   27 |             always_on_top: true
   28 |     }
   29 |     ctx := &Context{ gg: gg.new_context(gconfig) }
      |                             ~~~~~~~~~~~~~~~~~~~~
   30 |     ctx.gg.window.set_user_ptr( ctx )
   31 |     go update() // update the scene in the background in case the window isn't focused
graph.v:30:16: error: unknown method: `C.sapp_desc.set_user_ptr`
   28 |     }
   29 |     ctx := &Context{ gg: gg.new_context(gconfig) }
   30 |     ctx.gg.window.set_user_ptr( ctx )
      |                   ~~~~~~~~~~~~~~~~~~~
   31 |     go update() // update the scene in the background in case the window isn't focused
   32 |     for {
graph.v:33:20: error: unknown method: `C.sapp_desc.should_close`
   31 |     go update() // update the scene in the background in case the window isn't focused
   32 |     for {
   33 |         if ctx.gg.window.should_close() {
      |                          ~~~~~~~~~~~~~~~
   34 |             break
   35 |         }
graph.v:36:6: error: unknown function: gg.clear
   34 |             break
   35 |         }
   36 |         gg.clear(gx.white)
      |            ~~~~~~~~~~~~~~~
   37 |         ctx.draw()
   38 |         ctx.gg.render()
graph.v:38:10: error: unknown method: `gg.Context.render`
   36 |         gg.clear(gx.white)
   37 |         ctx.draw()
   38 |         ctx.gg.render()
      |                ~~~~~~~~
   39 |     }
   40 | }
graph.v:68:6: error: unknown function: gg.post_empty_event
   66 | fn update() {
   67 |     for {
   68 |         gg.post_empty_event()
      |            ~~~~~~~~~~~~~~~~~~
   69 |         time.sleep_ms(16) // 60 fps
   70 |     }
  1. Problem with -live (working v-0.1.29vexampleshot_reload>v run message.v)
v-0.1.29\v\examples\hot_reload\message.exe"
new_lib_path: C:\\Users\\user\\.cache/tmp.1.message.dll does not exist
errors while compiling message.v

19.

v-0.1.29\v\examples\gg>v run gg_freetype.v
gg_freetype.v:78:14: warning: reference field `App.gg` must be initialized
   76 |
   77 | fn main() {
   78 |     mut app := &App{}
      |                 ~~~~~
   79 |     app.gg = gg.new_context({
   80 |         width: win_width
gg_freetype.v:78:14: warning: reference field `App.ft` must be initialized
   76 |
   77 | fn main() {
   78 |     mut app := &App{}
      |                 ~~~~~
   79 |     app.gg = gg.new_context({
   80 |         width: win_width
g.scale=1 is_high_dpi=false fb_w=600 fb_h=700

Some issues when resizing similar like on https://github.com/vlang/v/issues/6133#issuecomment-674184582
v  gg_freetype v

20.

v-0.1.29\v\examples\gg>v run gg2.v
gg2.v:5:8: warning: module 'os' is imported but never used
    3 | import gg
    4 | import gx
    5 | import os
      |        ~~
    6 |
    7 | const (
gg2.v:18:14: warning: reference field `App.gg` must be initialized
   16 |
   17 | fn main() {
   18 |     mut app := &App{}
      |                 ~~~~~
   19 |     app.gg = gg.new_context(
   20 |         bg_color: gx.white
g.scale=1 is_high_dpi=false fb_w=600 fb_h=300

As upper
v gg2 v

21.

v-0.1.29\v\examples\game_of_life>v run life_gg.v
life_gg.v:14:2: error: undefined ident: `glfw`
   12 |
   13 | fn new_graphics() &gg.Context {
   14 |     glfw.init_glfw()
      |     ~~~~
   15 |     return gg.new_context(gg.Cfg{
   16 |         width: screen_width
life_gg.v:15:27: error: unknown struct: gg.Cfg
   13 | fn new_graphics() &gg.Context {
   14 |     glfw.init_glfw()
   15 |     return gg.new_context(gg.Cfg{
      |                              ~~~~
   16 |         width: screen_width
   17 |         height: screen_height
life_gg.v:32:5: error: unknown function: gg.clear
   30 | [live]
   31 | fn print_automaton(a &automaton.Automaton){
   32 |     gg.clear(gx.white)
      |        ~~~~~~~~~~~~~~~
   33 |     square_size := 18
   34 |     for y := 1; y<a.field.maxy; y++ {
life_gg.v:48:22: error: unknown method: `C.sapp_desc.should_close`
   46 |     mut a := automaton.gun()
   47 |     for {
   48 |         if graphics.window.should_close() { graphics.window.destroy() break }
      |                            ~~~~~~~~~~~~~~~
   49 |         gg.post_empty_event() // needed so the animation does not stop
   50 |         ///////////////////////////////////////////////
life_gg.v:49:6: error: unknown function: gg.post_empty_event
   47 |     for {
   48 |         if graphics.window.should_close() { graphics.window.destroy() break }
   49 |         gg.post_empty_event() // needed so the animation does not stop
      |            ~~~~~~~~~~~~~~~~~~
   50 |         ///////////////////////////////////////////////
   51 |         a.update()
life_gg.v:53:12: error: unknown method: `gg.Context.render`
   51 |         a.update()
   52 |         print_automaton(a)
   53 |         graphics.render()
      |                  ~~~~~~~~
   54 |     }
   55 | }

Is this normall?

Probably, you need a Bourne shell for that. Try MSYS if you're interested.

I'm on Windows 2004 and none of the GUI based examples work at all, while less than half of the command line based ones barely hold themselves together. Problems like this in natively coded examples is likely to cause people(like myself) to view the language or the compiler as buggy and unstable, while disproving your own statements as the language being "stable", and "cross-platform". However, I love the work you guys have put into this and am sure you will fix these someday :D

The problem's only on Windows, all of these will be fixed of course.

Graphical applications should all work now.

With V 0.1.29 c599a4c on Windows 10 2004:

  1. Works.
  2. Runes aren't implemented, yet.
  3. Works, no warnings.
  4. Works, no warnings.
  5. path_tracing.v needs updated to the latest changes in V. Shows a lot of warnings, now.
  6. Same as 2.
  7. Works, with one warning (due to recent change in V).
  8. This was with v run log.v... and I still get the same output. Is it supposed to crash?
  9. Works, with one warning (due to recent change in V).
  10. Works, with one warning (due to recent change in V).
  11. Works, with one warning (due to recent change in V).
  12. I got a different error.
  13. Works, with one warning (due to recent change in V).
  14. Works.
  15. Works.
  16. Several errors, but this was for older version of V. New net.http code is in a PR.
  17. Definitely needs updated.
  18. I get the same error.
  19. There is no such file in the examples/gg directory now. Probably because the last vestiges of freetype have been removed.
  20. There is no such file in the examples/gg directory now.
  21. Works.

So, with the latest V, there are some warnings to clean up due to recent V changes, a couple of examples need to be updated (they were just plain written for older versions of V), a few things to update, and one duplication for a feature that isn't implemented, yet. Should probably remove that example until it does.

Not as bad as it looked from the list of things above.

As of V 0.1.29 7727aad (commit pushed this morning):

2 - Runes aren't implemented, yet.
5 - path_tracing.v needs updated to the latest changes in V. Shows a lot of warnings, now.
6 - DUPLICATE - Same as 2.
8 - This was with v run log.v... and I still get the same output. Is it supposed to crash?
12 - I got a different error.
16 - Several errors, but this was for older version of V. New net.http code is in a PR.
17 - Definitely needs updated.
18 - I get the same error.

The rest work as expected (or are no longer there). The warnings reported on others are gone.

So out of the 21 issues reported, we're down to only 7 that need some attention. They'll get it once things settle a bit with the compiler and library.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

choleraehyq picture choleraehyq  路  3Comments

radare picture radare  路  3Comments

vtereshkov picture vtereshkov  路  3Comments

lobotony picture lobotony  路  3Comments

aurora picture aurora  路  3Comments