→ Lipraxde: gtk+-3.0 --cflags,中間有個空白 03/01 06:09
你好,感謝
將編譯參數改為
gcc -Wall hello.c -o Hello `pkg-config gtk+-3.0 --cflags --libs`
便可正常邊譯
但在執行時卻顯示
Gtk-WARNING **: cannot open display:
我猜是Xwindow的參數設定錯誤
但目前還沒有解答(絕讚google中)
如果有解決方法還請幫忙解惑<(_ _)>
話說有沒有辦法不靠Xwindow直接執行的方法(windows下)
※ 編輯: wei115 (101.138.162.172), 03/01/2018 13:46:06
→ Lipraxde: startxwin,那篇文章不是有寫嗎... 03/01 14:15
→ Lipraxde: 乖乖用linux會幫你省很多麻煩 03/01 14:15
用了startwin但沒辦法,執行後左下角出現X的圖示,但右鍵後卻沒教學說的
Terminal選項
至於linux嘛.....圖形模式比windows難QQ
而且我想寫windows的GUI程式.
以下log
(II) xorg.conf is not supported
(II) See http://x.cygwin.com/docs/faq/cygwin-x-faq.html for more information
LoadPreferences: /home/weinb/.XWinrc not found
LoadPreferences: Loading /etc/X11/system.XWinrc
LoadPreferences: Done parsing the configuration file...
winDetectSupportedEngines - RemoteSession: no
winDetectSupportedEngines - DirectDraw4 installed, allowing ShadowDDNL
winDetectSupportedEngines - Returning, supported engines 00000005
winSetEngine - Multi Window or Rootless => ShadowGDI
winScreenInit - Using Windows display depth of 32 bits per pixel
winAllocateFBShadowGDI - Creating DIB with width: 1366 height: 768 depth: 32
winFinishScreenInitFB - Masks: 00ff0000 0000ff00 000000ff
winInitVisualsShadowGDI - Masks 00ff0000 0000ff00 000000ff BPRGB 8 d 24 bpp 32
MIT-SHM extension disabled due to lack of kernel support
XFree86-Bigfont extension local-client optimization disabled due to lack of
shared memory support in the kernel
glWinSelectGLimplementation: Loaded 'cygnativeGLthunk.dll'
(II) AIGLX: Testing pixelFormatIndex 1
GL_VERSION: 3.1.0 - Build 9.17.10.4229
GL_VENDOR: Intel
GL_RENDERER: Intel(R) HD Graphics 3000
(II) GLX: enabled GLX_SGI_make_current_read
(II) GLX: enabled GLX_SGI_swap_control
(II) GLX: enabled GLX_MESA_swap_control
(II) GLX: enabled GLX_SGIX_pbuffer
(II) GLX: enabled GLX_ARB_multisample
(II) GLX: enabled GLX_SGIS_multisample
(II) GLX: enabled GLX_ARB_fbconfig_float
(II) GLX: enabled GLX_EXT_fbconfig_packed_float
(II) GLX: enabled GLX_ARB_create_context
(II) GLX: enabled GLX_ARB_framebuffer_sRGB
(II) AIGLX: enabled GLX_MESA_copy_sub_buffer
(II) 60 pixel formats reported by wglGetPixelFormatAttribivARB
(II) 24 fbConfigs
(II) ignored pixel formats: 0 not OpenGL, 0 unknown pixel type, 36
unaccelerated
(II) GLX: Initialized Win32 native WGL GL provider for screen 0
winPointerWarpCursor - Discarding first warp: 683 384
(--) 5 mouse buttons found
(--) Setting autorepeat to delay=500, rate=31
(--) Windows keyboard layout: "00000404" (00000404) "Chinese (Traditional) -
US Keyboard", type 7
(--) Found matching XKB configuration "Chinese (Traditional)"
(--) Model = "pc105" Layout = "cn" Variant = "none" Options = "none"
Rules = "base" Model = "pc105" Layout = "cn" Variant = "none" Options = "none"
winInitMultiWindowWM - DISPLAY=:0.0
winMultiWindowXMsgProc - DISPLAY=:0.0
cat: '': No such file or directory
winInitMultiWindowWM - xcb_connect () returned and successfully opened the
display.
winProcEstablishConnection - winInitClipboard returned.
winClipboardThreadProc - DISPLAY=:0.0
winMultiWindowXMsgProc - xcb_connect() returned and successfully opened the
display.
Using Composite redirection
OS maintains clipboard viewer chain: yes
winClipboardProc - XOpenDisplay () returned and successfully opened the
display.
LoadPreferences: /home/weinb/.XWinrc not found
LoadPreferences: Loading /etc/X11/system.XWinrc
LoadPreferences: Done parsing the configuration file...
SetupSysMenu: GetSystemMenu() failed for HWND 0xe802ce
SetupSysMenu: GetSystemMenu() failed for HWND 0xc0764
LoadPreferences: /home/weinb/.XWinrc not found
LoadPreferences: Loading /etc/X11/system.XWinrc
LoadPreferences: Done parsing the configuration file...
SetupSysMenu: GetSystemMenu() failed for HWND 0xe802ce
SetupSysMenu: GetSystemMenu() failed for HWND 0xc0764
※ 編輯: wei115 (120.109.128.225), 03/01/2018 14:34:09
→ Lipraxde: 改用Mingw,或者Qt 03/01 15:19
→ wei115: 好吧QQ 03/01 15:36
→ wei115: 謝謝 03/01 15:36
推 rehon: 改用msys2 這比cygwin好用多了 03/01 20:18
謝謝,改用msys2了,但目前變成設定msys2出問題了....
→ joe820730: 用VcXsrv搭建XWindow,然後term底下輸入: 03/01 23:25
→ joe820730: export DISPLAY=127.0.0.1:0 03/01 23:25
→ joe820730: 不過如果真要弄GTK還是用Linux吧,畢竟GTK生於Linux 03/01 23:30
→ joe820730: 用cygwin跑GTK的話會接到Xwindow,直接用MinGW才會直接 03/01 23:36
→ joe820730: 直接使用Windows的視窗 03/01 23:37
恩恩,感謝,回去查了才知道 MinGW的gcc 和 cygwin的gcc 有差別QQ,目前改用MSYS2中
→ uranusjr: GTK 在 Windows 上就是個悲劇, 別自找麻煩 03/02 18:32
為什麼是悲劇阿?
推 xvid: 可以考慮改用 Qt 03/03 20:53
我想用C寫視窗.....
※ 編輯: wei115 (59.126.109.77), 03/03/2018 21:12:16
喔喔,感謝各位大大
終於搞好了,用MSYS2安裝GTK好容易阿阿阿阿(雖然裝MSYS2環境的時候發生不少問題)
話說我終於搞清楚cygwin和MinGW的差別了
以前一直以為MinGW只是把編譯相關的東西從cygwin獨立出來
結果不是,還有一些引用函式庫的不同(cygwin POSIX, MinGW WIN32)
好八,看來可以開始hello, world惹QQ
※ 編輯: wei115 (59.126.109.77), 03/04/2018 03:19:04