Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of compiling and running c in notepad

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you the method of notepad compilation and running c, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!

How does notepad compile and run c?

Step 1: write c code

# includeint main () {printf ("hello world"); return 0;}

Step 2: press F5 to run for macro definition

Cmd / k gcc-o "$(CURRENT_DIRECTORY)\ $(NAME_PART) .exe" $(FULL_CURRENT_PATH) "& & CLS & &" $(CURRENT_DIRECTORY)\ $(NAME_PART) .exe "& PAUSE & EXIT

Press enter to get the result.

After you choose to save, you can choose a shortcut key, and next time you can press the shortcut key directly to run perfectly!

Step 3: run perfectly

Supplement

Compile:

Cmd / k gcc-Wall-o "$(CURRENT_DIRECTORY)\ $(NAME_PART) .exe"$(FULL_CURRENT_PATH)" & PAUSE & EXIT

Run:

Cmd / k "$(CURRENT_DIRECTORY)\ $(NAME_PART) .exe" & PAUSE & EXIT

About the script line: cmd / k gcc-o "$(CURRENT_DIRECTORY)\ $(NAME_PART) .exe"$(FULL_CURRENT_PATH)" & & CLS & & "$(CURRENT_DIRECTORY)\ $(NAME_PART) .exe" & PAUSE & EXIT

Cmd / k pops up the cmd window and executes subsequent instructions. & and & & indicate connectivity, indicating that multiple lines of instructions are combined into one line.

Gcc-o "$(CURRENT_DIRECTORY) $(NAME_PART) .exe" $(FULL_CURRENT_PATH) "compiles the .exe file and outputs the directory where the source file is located. Note that quotation marks are required in order to work properly even if there are spaces in the directory and file name.

& & CLS clear the screen. The meaning of & & is that there is an error in the previous statement and the sentence will not be executed.

& "$(CURRENT_DIRECTORY) $(NAME_PART) .exe" runs the .exe file you just generated. If there is a previous compilation error, it will not run.

& PAUSE pauses and prompts "press any key to continue". It will be executed here, regardless of whether there is an error or not. So what we see is a compilation error, a window that displays an error message and pauses.

& EXIT exits.

The above is all the contents of this article "how to compile and run c in notepad". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report