Compiling Code

Hi i am new to programming im having a bit of a problem i have installed kubuntu on my computer and i have wrote some code but when i go to compile it i get this error in the terminal

ross@ubuntu:~/cp1$ g++ -ansi -pedantic array.cpp -o array
ross@ubuntu:~/cp1$ array
The program 'array' is currently not installed. You can install it by typing:
sudo apt-get install sufary
bash: array: command not found
ross@ubuntu:~/cp1$

usually when i compile it and type array on the uni computers the programme will run but i don't know why it isnt on my kubuntu

You must start a program/script with the full path if it's not in a directory in the $PATH variable. Start the program with the current path:

./array

Thanks for the reply that worked :slight_smile:

Just a question at uni they use fedora and you can just type array instead of having to type ./array

Just wondering why that is ?

Is it diffrent in kubuntu than it is in fedora?

Probably the current directory is included in the $PATH variabel as a dot (.).

Regards