User forums > Using Code::Blocks
Multiple definition during linking console executable
Jenna:
It looks like you try to compile a project, that has multiple sorce files, that declare a main-function.
wzyjy:
--- Quote from: jens on December 14, 2010, 04:28:11 pm ---It looks like you try to compile a project, that has multiple sorce files, that declare a main-function.
--- End quote ---
maybe that's the problem, but please correct me if I'm wrong, this whole source code package would generate several executables, and for each one, is it suppose to be one corresponding main-function?
And why this is not a problem if I just use the makefile under the command line? - I just switched from Windows to Linux, so really not sure about how the makefile works.
reckless:
can easily get around it by supplying -Wl,--allow-multiple-definition to the linker flags.
wzyjy:
--- Quote from: reckless on December 14, 2010, 05:05:41 pm ---can easily get around it by supplying -Wl,--allow-multiple-definition to the linker flags.
--- End quote ---
Sorry I just started to use C:B but could you clarify how exactly I can do that, please?
oBFusCATed:
wzyjy: one target can create only one executable/library
You have two solutions:
1. create one project with multiple targets (see the codeblocks.cbp file)
2. create multiple projects and add them to a workspace
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version