I think it is recommended to use Visual Studio, but there may be other IDEs that are compatible with Unreal engine. But you do need to use a C++ project.
All C++ projects have a source folder and the first files in this folder are the *.Target.cs files, this is where you would add these lines of code.
Here are some examples for a project I names Sarlack.
(The log in the compiler said to use V5, so I switched it from V4 to V5 and everything still compiled OK.)