简体   繁体   中英

Windows gui C build system in sublime text

I had linker error: undefined reference to windows.h functions like textout,selectobject,beginpaint. But I was able to remove the error by adding "-mwindows" in sublime build system. But now im not able to get any output in windows terminal. Eg: if i try to use printf("test"); it won't show any output in windows terminal and textout() will only output textout string in gui window.

I tried it with codeblocks and it was able to get output of printf in windows terminal and textout in another window.

Is there anyway i can make sublime build system do the same?

{
"cmd": ["gcc", "-Wall","-mwindows","-pedantic-errors", "$file_name","-o", "${file_base_name}.exe", "&&", "start", "cmd", "/k" , "$file_base_name"],
"selector": "source.c",
"working_dir": "${file_path}",
"shell": true
}

If you want to build a console application, then you need to also add the -mconsole option to your compiler command line.

That will give you a Windows application that automatically creates and runs in the context of a console (text-based environment).

If you just pass -mwindows , then you get a standard Windows application that expects to have a GUI. You (your code) is responsible for creating a window and outputting text/graphics to that window. It doesn't happen automatically.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM