How to have more than 1 main function in a project?
Answered
I have recently started learning c.I have created a new project to store all the file.For example i have two file one prime number file and one perfect number file.Each has one main function but clion doesn't allow me to run the files.I found a similar post in the forum but that didn't help me.
Please sign in to leave a comment.
Hello! For each *.cpp file which has a main function you must have a separate
add_executable(target_name name_of_the_file.cpp)line in the CMakeLists.txt.