News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Multiple main()s in project?

Started by TravisB, December 07, 2009, 02:23:22 AM

Previous topic - Next topic

TravisB

Hello there C::B community!

I'm doing my best to learn C/++.  I have a book on each topic respectively, and am going at a steady pace.

The way I worked with earlier languages (*shudders* java included) was to use an IDE that worked pretty well (and then there was eclipse because I needed it for the ADT plugin for android development!), create a project with the title of the book, and do each of the tutorials throughout it.

I'm really using "project" as a directory to show in the workspace for formatting purposes. 

Is there any way to have multiple main()s, and when hitting 'run' only build/run the one file I'm currently working on?  If not, is there any other way I can go about what I'm attempting to do?  (I may just use vim for these small things, and C::B for actual projects that I work on).

Thanks in advance!

Travis.

MortenMacFly

Quote from: TravisB on December 07, 2009, 02:23:22 AM
Is there any way to have multiple main()s, and when hitting 'run' only build/run the one file I'm currently working on?
Look here:
http://www.codeblocks.org/docs/main_codeblocks_en.html
and here:
http://wiki.codeblocks.org/index.php?title=The_build_process_of_Code::Blocks

...basically you setup multiple targets ("mains") in your project, probably virtual targets if needed and you're done.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]