User forums > Using Code::Blocks

2 functions in diffrent c files that have the same name

(1/4) > >>

erezz:
I have a sample c::b project (attached) with 4 c files, each with a main() & foo1() functions. If I go to one of these files (e.g. b.c), select management->symbols, set view = current file's symbols, select "Global functions" and then click "foo1", it will go to foo1() in another file (sometimes it's a.c::foo1 or d.c::foo1). This sounds like a bug.

Erez

stahta01:
Please try your test on a project that DOES NOT have this error when building one of the Targets!

multiple definition of `main'

Tim S.

erezz:

--- Quote from: stahta01 on November 03, 2013, 05:34:17 pm ---Please try your test on a project that DOES NOT have this error when building one of the Targets!

multiple definition of `main'

Tim S.

--- End quote ---

I will test it according to your suggestion. Still, I think that even a project that does not compile should not have this behavior, right?

Erez

erezz:

--- Quote from: stahta01 on November 03, 2013, 05:34:17 pm ---Please try your test on a project that DOES NOT have this error when building one of the Targets!

multiple definition of `main'

Tim S.

--- End quote ---

I created my own Makefile and added it to the project (attached) as a custom Makefile. I still get the exact same behavior.

Erez

ollydbg:

--- Quote from: erezz on November 03, 2013, 03:12:12 pm ---I have a sample c::b project (attached) with 4 c files, each with a main() & foo1() functions. If I go to one of these files (e.g. b.c), select management->symbols, set view = current file's symbols, select "Global functions" and then click "foo1", it will go to foo1() in another file (sometimes it's a.c::foo1 or d.c::foo1). This sounds like a bug.

Erez

--- End quote ---
If the same function body is added, the later one will replace the former one. Why do we need to have two records for different functions.
If you have four header files which all have a same function declaration, and you have four source have the same function definition, how many records do you think CC need? You may expect there need 8 (this is a bit mass), but in fact, there is only ONE. CodeCompletion plugin's parser just merge all the function declaration and definition to only one record. So, you can switch from declaration and information very quickly, also keep the record database as small as it can.

BTW: CC just ignore your makefile, because it does not have the ability to parse and analysis the makefile structure and dependency rules. Anyway, if you want this feature, patches are welcome, I just don't have motion to do this. :)

Navigation

[0] Message Index

[#] Next page

Go to full version