Author Topic: basic questions  (Read 6779 times)

Offline kateausten

  • Multiple posting newcomer
  • *
  • Posts: 19
basic questions
« on: March 25, 2010, 01:21:12 pm »
Hello,

is it possible to run two different projets at the same time from codeblocks ?
I would also like to know if it is possible to generate an automatic makefile for a given project, as much as a header for every source file (that contains for instance the prototypes, the include, typedef and define lines, and a protection against double inclusion based on the name file).

Offline ptDev

  • Almost regular
  • **
  • Posts: 222
Re: basic questions
« Reply #1 on: March 25, 2010, 01:38:27 pm »
Hello,

is it possible to run two different projets at the same time from codeblocks ?
I would also like to know if it is possible to generate an automatic makefile for a given project, as much as a header for every source file (that contains for instance the prototypes, the include, typedef and define lines, and a protection against double inclusion based on the name file).

Hi,

Code::Blocks can have several projects open at the same time, yes. A set of open projects populates a workspace, and workspaces themselves can be saved. However, only one project may be active at a time, for compiling, but the project list will highlight which one for you at all times.

While using C::B, the program will use its own internal make system. You still have the option of exporting makefiles, although that alternative was abandoned a while ago and can result in buggy makefiles AFAIK.

You'll also be happy to know that there is a class wizard that generates classes with separated header and implementation, double include guards, and other things to help you save time.

Offline kateausten

  • Multiple posting newcomer
  • *
  • Posts: 19
Re: basic questions
« Reply #2 on: March 25, 2010, 01:52:55 pm »
Hello,
thanks for trying to help me. You said several projets can be opened at the same time, I know that. But I want to run 2 of them at the same time, using the 'run' command. So far, after I've run the first one and when I switch to the second one, the 'run' line (in build, ctrl+f10) is grey.

How can I export makefiles then ?

I don't know what a 'class wizard' is. Can you tell me basically what to do step by step to generate headers ?

Offline ptDev

  • Almost regular
  • **
  • Posts: 222
Re: basic questions
« Reply #3 on: March 25, 2010, 02:02:45 pm »
Hello,
thanks for trying to help me. You said several projets can be opened at the same time, I know that. But I want to run 2 of them at the same time, using the 'run' command. So far, after I've run the first one and when I switch to the second one, the 'run' line is grey.

The same focus for compiling applies to running compiled executables. Code::Blocks waits for it to finish execution. You can, however, pass arguments to the executable by going to Project > Set Program Arguments. In the same menu, you can also choose which executable to use for testing a DLL/shared object, should one of your projects be one.

Or, you could do a little dirty trick: add one of the resulting executables to the Tools menu, and allow it to run concurrently to C::B. Whenever you want to test both executables simultaneously, call the "tool" program, and then run the active project.

Quote
How can I export makefiles then ?

I looked in the Project properties dialog for it, and I'm afraid makefile generation really was removed from C::B a while ago. I'm sorry for being misleading in this respect.

Quote
I don't know what a 'class wizard' is. Can you tell me basically what to do step by step to generate headers ?

Go through File > New > Class. The dialog you obtain will be the class wizard. You can setup all sorts of things in there, including scope guards, data members, and even preliminary documentation.

If you're not interested in writing c++ classes, but rather just headers, just do File > New > Empty File. A file only is defined as a header or source, once you name it. No automation involved though, I'm afraid.
« Last Edit: March 25, 2010, 02:08:11 pm by ptDev »

Offline kateausten

  • Multiple posting newcomer
  • *
  • Posts: 19
Re: basic questions
« Reply #4 on: March 25, 2010, 02:20:55 pm »
I'm sorry I don't really know how to apply what you said to my problem : I have a client project and a server project. I need to first run the server then the client. How do I do that ?

So if codeblocks doesn't do it, is there another very easy to use program that generates makefiles ?

My programs are in C. I know how to code on c but not that much on c++.  Is that going to be a problem ?
Maybe you can help me to generate the simple headers with the options that I've mentionned ? (for each function definition, copy paste it and append a ';' to make it a prototype. Also cut all include, typedef and define that are in the beginning of the source and paste them in the header. Include the header to the source and add a double inclusion protection).

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: basic questions
« Reply #5 on: March 25, 2010, 02:56:48 pm »
kateausten: you can run two c::b simultaneously (should modify some options though)

for makefiles, you can try cbMakefileGen, but it is unmaintained.

p.s. remember to search the next time, there is plenty of info about makefile generation (its lack in cb)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline kateausten

  • Multiple posting newcomer
  • *
  • Posts: 19
Re: basic questions
« Reply #6 on: March 25, 2010, 03:02:59 pm »
What do I have to do to be able to run 2 codeblocks simultaneously ?
This one I found out by myself, thanks. Isn't there any better way to run 2 projects in the same codeblocks instance ?

Maybe I should use something that is not cb related then to generate makefiles. Any ideas ?

What about the header generation using classes ?
« Last Edit: March 25, 2010, 08:07:48 pm by kateausten »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: basic questions
« Reply #7 on: March 25, 2010, 08:54:13 pm »
You can use the tools menu (option) for that purpose. setup a tool that runs your target output executable in a detached shell. If you are using macros to point to the executable(s) it#ll work generally.

Alternatively to allow running more than one C::B instance go to settings -> environment -> Disable "Allow only one running instance". Probably you want to disable "Use an already running instance" on Windows, too.
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

Offline kateausten

  • Multiple posting newcomer
  • *
  • Posts: 19
Re: basic questions
« Reply #8 on: March 26, 2010, 04:00:09 am »
ok, thanks.
Any ideas as which non related cb sofware would help me to generate simple makefiles?

What about the header generation using classes ?