Skip to content

CM3106 - Computer Graphics Using C

by yashppawar

Reference : Colorado BGI Docs


Installation

Download and install the cs1300-setup.msi1 from the CSCI 1300 Software Package2, then use the cs1300-command-prompt.exe to build and run!

VS Code does not recognize <graphics.h>

to fix the above error, we update the C/C++ Configurations c_cpp_properties.json and udpate the includePath

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**",
                "C:\\Program Files (x86)\\Colorado\\cs1300\\include" // Add this line
            ],
            // Other Properties
        }
    ]
}
The properties file can be opened by opening the Command palette (by using shortcut Ctrl+Shift+P) and then typing "C configurations" > "Edit Configurations (JSON)"

💻 Build and Run!

The code files are C++ files, these can have any of the following extensions .C, .cc, .cpp, .CPP, .c++, .cp, or .cxx.3

To build (in general) we will use the GNU g++ compiler

C:\Codes> g++ input-file.cc -o output.exe
$ g++ input-file.cc -o output.out

and then to execute the program

C:\Codes> output.exe
$ ./output.out

but for <graphics.h> we will be using the bgi++ compiler provided in the CS1300 tools

C:\Codes> bgi++ input-file.cc -o output.exe
C:\Codes> output.exe

Flags

various flags can be used to customize the output of the compiler

-g                      Generate source-level debug information
-o <file>               Write output to <file>
-W<warning>             Enable the specified warning
the -Wall will enable all warnings

C:\Codes> bgi++ input-file.cc -o output.exe -g -Wall