Configure the c # compiling environment for sublime Text 2 in linux,

Source: Internet
Author: User

Configure the c # compiling environment for sublime Text 2 in linux,

Don't laugh at me. I ran xp on a virtual machine and installed vs2008 on it. The computer performance was really poor, so I installed sublime to write code, then it will be debugged by vs2008.

Let's talk about things.

After installing sublime, you need to install a c # IDE, or you need to obtain a compilation command that can be compiled on the command line similar to java javac.

Here I have installed MonoDevelop, and it seems that the available C # compiler only has Mono. If you see a better compiler, you can introduce it to me. Project Homepage

Http://mono-project.com/main_page. : Http://www.go-mono.com/mono-downloads/download.html

It seems that you can also use apt-get install MonoDevelop or apt-get install Mono.

After the installation is complete, enter mono -- version in the command line. If you can see what is shown in, the installation is successful.

johnny@johnny-pc:~$ mono --versionMono JIT compiler version 3.2.8 (Debian 3.2.8+dfsg-4ubuntu1)Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com    TLS:           __thread    SIGSEGV:       altstack    Notifications: epoll    Architecture:  amd64    Disabled:      none    Misc:          softdebug     LLVM:          supported, not enabled.    GC:            sgenjohnny@johnny-pc:~$ 

That's all.

Sublime Text 2 has two key commands for compiling and running c #.

"Mcs" -- compile the *. cs FILE command. Specific description of "mcs": http://www.mono-project.com/CSharp_Compiler

"Mono" -- run the *. exe file generated after compilation.

Configure C # Build System for Sublime Text 2

Open sublime text 2 and choose Tools> Build System> New Build System.

Enter the following code:

{    "cmd": ["mcs", "$file"],    "file_regex": "^(...*?):([0-9]*):?([0-9]*)",    "selector": "source.cs",    "encoding": "GBK",    "variants":      [         {             "name": "Run",             "cmd": ["mono", "${file_path}/${file_base_name}.exe"]         }      ]  }

For details about parameters of sublime text 2 Build System, see http://www.sublimetext.com/docs/build. Click Save and enter the file name C #. sublime-build. The file will be saved to the Packages/User folder by default. Now, the configuration of sublime text 2 is complete.

Test the compiling and running environment

Write a piece of code to open the sublime command line

After "Ctrl + B" is compiled, a prompt is displayed. An exe file with the same name will be generated under the *. cs directory.

 

Press Ctrl + Shift + B to run the command again.

 

 

Now, the environment is configured.

 

The Code style plug-in is provided by default. Simply select and use.

 

Add annotation for c # code

The comment shortcut in C # is invalid becausePackages folderThe file defining the annotation behavior is missing. Open Packages and add a name in the C # Folder:Comments. tmPreferencesFile, enter the following content:

 


In win8, sublime text2 can be configured to run in C.

Tdm-gcc + sublime text2
 
Sublime text: c \ c ++ Development Environment configuration method on win7 System

See sublime text 2 configure c \ c ++ development environment:
Www.cnblogs.com/..8.html
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.