Reputation:
I have recently started c programming. And I'm having trouble with the following. For example I have two files one for prime numbers and one for perfect numbers. They each have one main function. But clion refuses to have two main functions even if they are in different files.i found some post with similar problem but that didn't help. It was something about cmake. Please help.
Upvotes: 0
Views: 45
Reputation: 409136
You have two ways to solve that problem:
Create two different projects, one for each program.
Use a single project, but create two different executable targets.
The first way is probably the simplest. The second way requires you to edit the CMakeLists.txt
file which could be a little harder, but it will hopefully teach you to not be afraid to do such edits (it's going to be required for more complicated projects) and perhaps also teach you a little of how the underlying system (CMake) works.
In the short run and just for a quick "fix", go the first route. If you're not afraid to learn something new, then go the second route.
Upvotes: 2