Jump to content

Recommended Posts

Hello to all.

My problem happens when compiling and linking several files in a project.

All source files compile perfectly - three of them are .lib files, compiled separately.

When linking, a REDEFINITION error occurs, in file i2c_bitbang.c

 

"C:\Program Files\SourceBoost\boostlink_pic.exe" -idx 1 /ld "C:\Program Files\SourceBoost\lib" libc.pic18.lib Debug\vars.obj Debug\main.obj Debug\io_lib.obj Debug\task_CommDisplay.obj Debug\task_CommPc.obj Debug\task_CommVoltmeters.obj Debug\task_Watchdog.obj Debug\misc.obj Debug\utils.obj Debug\spi_pic18_lib.obj Debug\adc_lib.obj Debug\sd_card_spi_lib.obj eeprom.pic18.lib ..\libs\i2c_bitbang.lib ..\libs\rtc_7941x.lib ..\libs\serial_uart2.lib /t PIC18F67K22 /d "Debug" /p BMS1_CpuBoard1

Z:\PROJ_LOCAL\Software\libs\I2C_BitBang\i2c_bitbang.c function redefinition: i2c_delay(void) in Z:\PROJ_LOCAL\Software\libs\I2C_BitBang\i2c_bitbang.c

Z:\PROJ_LOCAL\Software\libs\I2C_BitBang\i2c_bitbang.c function redefinition: i2c_init(void) in Z:\PROJ_LOCAL\Software\libs\I2C_BitBang\i2c_bitbang.c

Z:\PROJ_LOCAL\Software\libs\I2C_BitBang\i2c_bitbang.c function redefinition: i2c_start(void) in Z:\PROJ_LOCAL\Software\libs\I2C_BitBang\i2c_bitbang.c

Z:\PROJ_LOCAL\Software\libs\I2C_BitBang\i2c_bitbang.c function redefinition: i2c_stop(void) in Z:\PROJ_LOCAL\Software\libs\I2C_BitBang\i2c_bitbang.c

Z:\PROJ_LOCAL\Software\libs\I2C_BitBang\i2c_bitbang.c function redefinition: i2c_tx(unsigned char) in Z:\PROJ_LOCAL\Software\libs\I2C_BitBang\i2c_bitbang.c

Z:\PROJ_LOCAL\Software\libs\I2C_BitBang\i2c_bitbang.c function redefinition: i2c_rx(bit) in Z:\PROJ_LOCAL\Software\libs\I2C_BitBang\i2c_bitbang.c

BoostLink Optimizing Linker Version 7.05

http://www.sourceboost.com

Copyright© 2004-2011 Pavel Baranov

Copyright© 2004-2011 David Hobday

 

failure

error: failed

Done

 

Why does this happen???

 

For your information: some i2c functions are called from main.c and from rtc7941.c - the later was previously compiled into a library.

Please refer to the inclosed files, i2c_redef_error.txt and the i2c files, i2c_bitbang.c and i2c_bitbang.h.

 

Thanks in advance for your future help.

P. Robalo

i2c_redef_error.txt

i2c_bitbang.h

i2c_bitbang.c

Link to post
Share on other sites

Hi P,

 

The problem may be that you are calling a function from a library that is contained within another library.

 

The i2c header maybe embedded into the rtc library. The i2c header is also embedded into main. The linker is seeing both headers as being defined.

 

This may not be the exact reason but sound plausible. Dave and Pavel could clarify :)

 

Remove rtc calling i2c functions and see what that does. (Remove i2c header as well)

 

Cheers

 

Reynard

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...