User forums > General (but related to Code::Blocks)

file in subject

<< < (3/3)

thanhbuu:
again it shows "multiple definition of `main'"

oBFusCATed:
Then you have two main functions in two files compiled together.

Please read this: http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F
And make sure you understand it!

stahta01:

--- Quote from: thanhbuu on May 18, 2012, 06:40:51 pm ---how can I do it? Please give me some detail if I want to build/debug a file? Thanks!

--- End quote ---

The fastest way is to use a separate project for each file; that will work for you.

My answer of using separate targets was to your original question (of compiling two files with main in each); I have no idea if debugging will work right with separate targets.

Tim S.

Jenna:

--- Quote from: stahta01 on May 19, 2012, 04:02:28 pm ---
--- Quote from: thanhbuu on May 18, 2012, 06:40:51 pm ---how can I do it? Please give me some detail if I want to build/debug a file? Thanks!

--- End quote ---

The fastest way is to use a separate project for each file; that will work for you.

My answer of using separate targets was to your original question (of compiling two files with main in each); I have no idea if debugging will work right with separate targets.

Tim S.

--- End quote ---
If the compiler-settings are correct, it will work, because you can debug one target and ignore the other one.

thanhbuu:
Anybody can do this (according to the tutorial as I mentioned or by your experience), can you post a video of the process so that everybody know this process? Thanks!

Navigation

[0] Message Index

[*] Previous page

Go to full version