Using libraries like math etc. for C / C++

Re: Using libraries like math etc. for C / C++

by Richard Lobb -
Number of replies: 0

The most direct way to set link arguments is via the CodeRunner question authoring form. If you click the 'customise' checkbox, then expand 'Advanced Customisation', you'll find there's a Sandbox Parameters field available.

Screenshot showing parameter field

One of the parameters for Jobe is a linkargs parameters, so for example if you set the Parameters field to


you'd include the math library. That and other Jobe sandbox parameters are documented in the section Run-spec Parameters at

You could make different C/C++ question types that used different libraries by setting different values for this parameter in new question prototypes.

However, increasingly authors prefer to deal with more difficult question types using Python scripting. I've just documented a simple example of a Python script for running C/C++ programs in a section called Supporting or Implementing New Languages in the CodeRunner file. This approach gives you much more flexibility, such as the ability to supply compile or link arguments through the question's template parameters field.