When you attempt to run a program from within an IDE, it has to go through several stages before it actually launches and begins running. These stages are generally compile, build and run.
Compile basically checks for any errors, and if none are found (or they're minor enough to only be warnings), the IDE will then translate your program into machine language to then be ran. The compile command only works on the current file you actively have open within the editor; it does not compile your entire project.
Because you can, and usually do, have more than one file in a program, you must compile the entire project before it can be ran. This is done by selecting "build", which should be somewhere near the compile option within the menus. Building a project also links necessary files, such as libraries, to your program. If everything is all good, you can then select the run command, which then creates an executable and launches your program.
So you need to build the program, or in other words compile the entire project, before you can successfully run your program.