0

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 } 
1
  • This "solution" doesn't make sense, these subsystems are mutually exclusive. Remove -mwindows. Commented Aug 23, 2017 at 5:17

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.