nimxを試そうと、
GitHub - yglukhov/nimx: GUI library
nimble install nimx
して、
READMEにある通りmain.nim
を作って、
import nimx.window import nimx.text_field proc startApp() = # First create a window. Window is the root of view hierarchy. var wnd = newWindow(newRect(40, 40, 800, 600)) # Create a static text field and add it to view hierarchy let label = newLabel(newRect(20, 20, 150, 20)) label.text = "Hello, world!" wnd.addSubview(label) # Run the app runApplication: startApp() Running
nim c -r --threads:on main.nim
を実行。
could not load: libSDL2.dylib compile with -d:nimDebugDlOpen for more information Error: execution of an external program failed: '/Users/shinriyo/development/nim_apps/nimx/main '
のエラー。
libSDL2.dylib
がないのか?
適当にググったら関係ないけどこのIssue
https://github.com/buggins/dlangide/issues/17
sudo cp /usr/local/lib/libSDL2/libSDL2.dylib /usr/local/lib/libSDL2.dylib
をしてコピー作れってあったけど、そもそも/usr/local/lib/libSDL2/libSDL2.dylib
がないじゃん。
そのIssueのREADME読めって書いてたのでたので、
brew install sdl2
をし、再度nim c -r --threads:on main.nim
を実行。
起動した!