PrevNext

Running Code Locally

Authors: Benjamin Qi, Hankai Zhang, Anthony Wang, Nathan Wang, Nathan Chen

Options for running your language of choice locally.

Which text editor or IDE should I use?

Depends on your personal preference. Try multiple and see which one you like best.

If you're just starting out, it's easier to begin by running code online and worry about running locally later.

Using an IDE

Resources
IOIfor reference, software you can use at IOI

Please let us know if you have trouble with installation!

Resources
GeanyLightweight, frequently used at IOI.
MicrosoftMore lightweight than Visual Studio Community, requires some configuration. See PAPS 2.1 and the docs for C++ setup instructions.
Code::BlocksWindows & Linux. Apparently was unstable at IOI.
AppleMac.
JetbrainsRequires a license, but free for students.

Using Command Line

You can run your C++ programs from the command line and use a text editor of your choice.

Text Editors

Resources
Fast, lightweight. Unlimited free evaluation period, though it will repeatedly ask you to purchase a license.
Classic text editor, usually preinstalled on Linux. Also see Neovim, MacVim
From the makers of Github.

Vim is probably the easiest way to print syntax-highlighted code on Mac, see the response to this post.

Sublime Text Notes (Ben)

  • I prefer the Mariana color scheme in place of the default.
    • open command palette (Cmd-Shift-P) -> change color scheme
  • subl symlink
    • Using /usr/local/bin/subl instead of ~/bin/subl worked for me on OS X Mojave.
  • Package - Sublime Linter (GCC)
    • highlights compilation errors and warnings from -Wall
    • can change compilation commands in linter.py
  • Package - Fast Olympic Coding (I don't use)
    • test manager can be useful
    • linting is covered by the above
    • stress testing is covered in Debugging
    • can't get debug to work

Further Instructions

See this module for information about installing, compiling, and running C++ from the command line.

Including <bits/stdc++.h>

You can use #include <bits/stdc++.h> in place of separately including libraries.

Usage

This is usable with GCC. However, Mac OS X uses Clang while Windows uses Microsoft Visual C++ (MVSC) by default. <bits/stdc++.h> is not a standard header file, so it will not work with the latter two. This is one of the reasons why you should not use <bits/stdc++.h> outside of competitive programming.

If you install GCC as described later in the module linked above, then you should be good to go.

OS-Specific Recommendations

This section is not complete.

Feel free to file a request to complete this using the "Contact Us" button.

Linux

Windows

Geany or CodeBlocks?

Mac

XCode?

Using <bits/stdc++.h> Without Installing GCC

If you installed Clang on Mac, then you can download stdc++.h from here and move it into a folder named bits that is located in the same directory as where all other C++ header files are located. However, this is not recommended.

Resources
SOsolutions that may or may not work

Module Progress:

Join the USACO Forum!

Stuck on a problem, or don't understand a module? Join the USACO Forum and get help from other competitive programmers!

Give Us Feedback on Running Code Locally!

PrevNext