NOI Linux 2.0 CSP Olympiad semi-final environment installation and use guide

The difference between old and new people

The following are changes that may cause the habits you formed under the old version of NOI Linux to overturn under the new version.

  • GUIDE removed
  • From a 32bit to a 64bit system, you need to note that the pointer now occupies 8 bytes instead of 4 bytes.
  • Updated compiler version
  • By default, the option of [New File] is not available when right-clicking.
  • Changing the desktop directory to Chinese may cause some programs to fail to run.

Main changes

  • The system is based on Ubuntu 20.04 (64bit)
  • g++ upgraded to 9.3.0
  • Many editors added, such as Sublime, VSCode, Code::Blocks

Install

There is no difference from the old version. The main thing is that the official website says to disconnect the network during installation. You can disconnect the virtual network card when installing the virtual machine software.

Edit: The system has now been used for CSP and NOIp. Whether online updates vary from exam center to exam center, and how to implement NOI is unclear. If you can update online, it is highly recommended to use VSCode and install the C/C++ plug-in for programming.

Chinese catalog

If you choose to install this system in Chinese, the desktop directory will be in Chinese.

Then this brings a lot of problems. First, it is very troublesome for you to type in the terminal. Second, some programs may not be used.

Please do not create file programming on the desktop to avoid unnecessary trouble. According to my testing, it is known that there will be problems with the compilation of Code::Blocks and Gedit.

Right-click menu to create a new file

If necessary, you can enter it in the terminal

xdg-user-dirs-update --set TEMPLATES ~/Templates/
touch ~/Templates/newfile

That’s it.

Then restart the file manager (you can enter it through the terminal  killall nautilus) and you will find that [New File] is back in the right-click menu.

wallpaper

The default wallpaper is an extremely ugly pure black wallpaper? It doesn’t matter, you can enter [Settings - Background] to change it.

There are interesting wallpapers, such as this one:

editor

As an aside, I like GUIDE very much, and I don’t understand why it was deleted. Maybe it is uncomfortable in many places, but it can set compilation options for each file independently, and does not require additional configuration. For me, This is really useful for players who frequently change compilation options for their code.

Generally speaking, I don't think it should take more than 5 minutes in the exam room to configure the editing environment. Especially for competitions like NOI, you cannot touch the keyboard or log in to the system before the exam starts, so any time spent configuring these things will take up your effective competition time. I recommend using one that can be configured quickly and is not obvious. Just drag down the coding efficiency. So I won’t introduce usage methods that require a lot of configuration here.

Also, I think the default fonts of these editors are pretty good-looking. If you don’t think they look good, you can find out how to change the fonts yourself.

In addition, some of the following editors will freeze when opening large files. Please test them carefully and avoid opening overly large samples without saving the code to avoid data loss .

If it is really stuck, this version of Ubuntu will pop up an unresponsive prompt after a long enough time. In most cases, you don’t need to do it manually. Of course,  killall if you don’t listen and there are unsaved codes in it, you can only wait a little longer. Wait for a few minutes to see if it can be restored, and then save it quickly. If not, send it completely.

VSCode

Unfortunately, the VSCode C/C++ plug-in provided by CCF is an online installation version, which is completely unusable in real competitions, so... I heard that you want a super easy-to-use VSCode? No way!

Having said that, VSCode without Intellisense and Debug can also be used. Although compilation requires manual typing on the command line, and debugging requires command line gdb, it is still possible in terms of syntax highlighting, automatic indentation and bracket completion. of.

Of course, you can also hand-write JSON to implement a compilation and running instruction. I won’t go into details. It’s quite complicated. Just search it online.

You can also tinker with a bunch of things in the settings, the more useful one is Auto Save.

It is worth mentioning that its built-in search function is very easy to use and is very effective when checking for duplicate names of variables. The three switches on the right respectively represent whether to be case-sensitive, whether to force search for words (with blank characters on both sides), and whether to enable regular expressions.

Basically, the normal usage is like this, using the built-in terminal to compile and run all the files.

advantage
  • It has simple syntax highlighting and a good editing experience.
  • It has its own file manager, which can easily create new files.
  • Almost no setup required
  • Bring your own terminal
shortcoming
  • It does not come with a compilation function. If implemented, handwritten JSON is required.
  • No built-in debugging function

Sublime Text

Does it feel similar to the VSCode experience? However, it comes with its own single-file compilation instructions. But I haven’t used it, so I won’t comment much.

But it feels really similar to VSCode. If you want to customize the compilation, you have to write JSON by hand.

advantage
  • It has simple syntax highlighting and a good editing experience.
  • Almost no setup required
shortcoming
  • Modifying compilation options requires handwritten JSON
  • No built-in debugging function

Geany

Geany basically works out of the box, but there are a few plugins you can turn on that I think are great.

[Tools-Plug-in Manager] You can open plug-ins in it

Some useful ones are:

  • 【Auto-close】Bracket completion
  • 【Auto-mark】symbol highlighting

F9 to compile, F5 to run, a terminal will pop up when running. Note that there is no compile + run, you need to press both.

Compilation options can be set in [Generate-Set Build Command].

However, one of the more troublesome things is that the Warning and Error displays are the same, so take a look.

Then you can click on the up and down arrows in the column below that says compiler. When you click on it, there will be a built-in terminal at the bottom. You can also stretch the lower column to display it all.

advantage
  • It has simple syntax highlighting and a good editing experience.
  • Almost no setup required
  • Bring your own terminal
shortcoming
  • No built-in debugging function

Code::Blocks

Because this thing seems to come with built-in debugging, I focused on researching it.

First of all, if you open a single file, there are only default compilation options and cannot be debugged, so it is inevitable to create a new project file.

First select [File-New-Project-Console Application] to create a new project, then select the name of the question for title, and then select the parent directory of the folder for storing the question specified by your competition in Folder, and leave the rest by default.

Then you have a project. First of all, you will find that it creates a main.cpp for you. Because OI competitions generally require a fixed name to collect it correctly, you need to change the name. First, close this file. Then right-click the file on the left, select [Rename File...], and change it to the name of the question.

Then, the basic configuration is done.

The next step is how to set the compilation options. This time, right-click the project icon on the left, and then click [Properties...].

Then click [Build Targets], click [Build options...] on this page, and you can set compilation options for [Debug] and [Release] respectively, and these two things can be understood as two modes, During the competition, you can use [Debug] as the one with similar options turned on  -g for troubleshooting, and the compilation options shown on the [Release] question page reflect the real effect. (Of course, you can also use [Add] on the left to add more modes according to your needs.)

Of course, the options given do not necessarily need to be used. You can use [Other Compiler Options] in the next column to write directly.

Now that it is configured, you can switch the compilation mode in the top option box, and then press the yellow gear and green arrow to represent compile, run, and compile and run respectively.

Then the red arrow on the right can start debugging. When debugging, you can click [Watches] in the icon with a bug on the computer on the right side of the debugging box to open the variables to view. Note that compilation must be enabled during debugging  -g ([Debug] mode compilation)

In short, the specific usage is quite complicated. After all, this is a huge IDE, and you can explore it by yourself.

Of course, you can also just use it for debugging, create a new project and leave other settings unchanged. If necessary, you can copy the code and adjust it. This is also possible. Anyway, this seems to be the only one that can be used for debugging.

advantage
  • Comes with debugging function
  • With simple syntax highlighting, the editing experience is okay
shortcoming
  • Auto-indentation can be a bit weird(?)
  • Configuration is troublesome, you must configure a project. Relatively bulky.

other

Vim and gedit (now called text editors) and Emacs are still there. Just keep using them if you like them. There shouldn't be many changes.

Summarize

VSCode is provided but no VSCode C/C++ plug-in that can be used normally is provided.

translater

The compiler has been upgraded to g++ 9.3.0. What can be done?

Powerful sanitizer

Adding the compilation option  -fsanitize=address,undefined allows you to experience an excellent RE and UB checking experience.

Of course, if the compiler and linker are separated, you need to add it to the linker  -lasan -lubsan before it can be used (referring to Code::Blocks)

It can be realized: if the array exceeds the boundary, it will be RE directly, if the signed integer overflows, it  will be RE directly. If void the function does  not return a value return , it will return direct RE... In short, you can check RE and UB, and it can tell you which line the error is  . Trust me, it's addictive.

optimization

Compiler optimization is smarter, although the perception may not be strong

C++14/17

Should it be used in official competitions in the future?

Edit: Confirmed: C++14 will be used in the future

Arbiter

arbiter seems to have been updated? Let me see the difference.

The maximum memory limit has been changed from 512MB to 2048MB. However, this seems to have been modified internally (refer to the previous 1GB space limit in NOI)?

It seems that the icon has also been changed.

So there seems to be no difference.

Terminal commands

It’s basically unchanged, and everything that is commonly used can be used. You can't use anything that doesn't work, except...

ssh

Happy to hear and see.jpg

In fact,  ssh the command has not been deleted, but the ssh service is not open. That is, you can still ssh to other systems, but this system cannot be ssh to.

I tried opening a network for the virtual machine and the physical machine to test it, but it didn't work.

Guess you like

Origin blog.csdn.net/abilix_tony/article/details/131949315