How to hide console window in Mac OS (gcc compiler)?

不打扰是莪最后的温柔 提交于 2020-01-01 19:54:29

问题


I write an application with Code::Blocks IDE in Mac OS (C++ application).

CodeBlocks uses gcc to compile the source code.

When I double click on the output of the project (executable binary file), my application executes correctly but a console application shown. My application is a background application without any reading or writing to console, and I add it to startup items. I don't want when I logon, a balnk console (of my application) shown. I want to hide the console window.

How to hide console window in Mac OS with gcc compiler?


回答1:


It sounds like what you are developing is a daemon (background process that is launched when a user account is logged on, or system is launched). OS X uses launchd and launchctl to manage daemons, so you'll need to set up the proper plist entry in either the /System/Library/LaunchAgents (to launch during system boot) or ~/Library/LaunchAgents (to launch when a user logs in) directory, and register it with launchctl.



来源:https://stackoverflow.com/questions/7794340/how-to-hide-console-window-in-mac-os-gcc-compiler

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!