3

I want to examine a lot of little cpp files that have int main() , and run only one of them at one running . something like this -

enter image description here

Is there any way to do that without open new project for every cpp file ?

0

2 Answers 2

4

You can choose not to compile the files. Go to the properties, and exclude the file from build.

Sign up to request clarification or add additional context in comments.

Comments

4

No. In a project, you cannot have multiple main() function.

You can rename them to test1(), test2(), test3(), and call them one by one from main(). That is what I do usually.

1 Comment

but for that you'll need to create header files for each of these and include the header file of say test1, as #include "test1.h", at the beginning of the main.cpp file right?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.