Reputation: 33
I'm on Mac OS Mojave(Version 10.14), using Eclipse Photon. I have a single C++ project(which won't show up in the C++ perspective, only the Java perspective), and I'd like multiple packages/folders for various things. For example:
- MyCPPProject
- School
- Lab01.cpp
- Lab02.cpp
- Personal
- File01.cpp
- File02.cpp
All of the C++ files will have main methods(which is why I can't run them if they're in the same project). All of the files will be "simple," meaning that they will not do anything beyond competitive programming(so nothing beyond cin
/cout
or scanf
).
The Internet says I need a new project for every main method. Does anyone have any ideas so that I can keep my programs in 1 project?
Thanks in advance.
Upvotes: 0
Views: 1430
Reputation: 121649
The way Java works, you can have a different static void main(String[] args)
for every Java class. Neither C nor C++ work like that: you're limited to exactly one "main()" per .exe.
That, in turn, means that you must define a separate project in Eclipse for each separate .exe. That's just the way it is :)
Eclipse, however, allows you to "group" projects into "Working Sets":
What is a working set and how do I use it?
So if you wanted to, you could organize your projects into "School" and "Personal", filtering out one or the other as you wish.
Finally, there are C/C++ "Online Fiddles" that allow you to easily run small, standalone .cpp files and that you might prefer over Eclipse, MSVS or CodeBlocks:
Upvotes: 2