Author Topic: Multiple main()s in project?  (Read 14391 times)

TravisB

  • Guest
Multiple main()s in project?
« on: December 07, 2009, 02:23:22 am »
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.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Multiple main()s in project?
« Reply #1 on: December 07, 2009, 06:30:32 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: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ