How to have more than 1 main function in a project?

已回答

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.

0

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.

0

请先登录再写评论。