Jump to content

error calling functions in 1 file from multiple other files


avockley
 Share

Recommended Posts

I am having an issue with accessing functions in 1 source file from multiple other source files. I have included my entire source directory, as I'm not really sure where the error is. The function I want to call are in uip_task.c, and they are called from both terminal.c and presets.c. The functions are called properly from terminal.c, but not from presets.c. I have included the compile log below. The first warning happens even with the tutorials, but doesn't seem to be causing any problems. The errors at the end are the problem that I'm having. I'm guessing it's an issue with an include somewhere, but as far as I can tell, it's all seems correct.

Aarons_Macbook_Pro:ArtNet Node aaron$ make

rm -f project.hex

Creating object file for app.c

Creating object file for terminal.c

terminal.c: In function 'TERMINAL_Init':

terminal.c:55:2: warning: passing argument 1 of 'MIOS32_MIDI_DebugCommandCallback_Init' from incompatible pointer type

/Users/aaron/svn/mios32/trunk/include/mios32/mios32_midi.h:253:12: note: expected 's32 (*)(enum mios32_midi_port_t, char)' but argument is of type 's32 (*)(enum mios32_midi_port_t, u8)'

Creating object file for presets.c

Creating object file for shell.c

Creating object file for main.c

Creating object file for tasks.c

Creating object file for list.c

Creating object file for queue.c

Creating object file for port.c

Creating object file for umm_malloc.c

Creating object file for startup_LPC17xx.c

Creating object file for mios32_srio.c

Creating object file for mios32_din.c

Creating object file for mios32_dout.c

Creating object file for mios32_enc.c

Creating object file for mios32_lcd.c

Creating object file for mios32_midi.c

Creating object file for mios32_osc.c

Creating object file for mios32_com.c

Creating object file for mios32_uart_midi.c

Creating object file for mios32_iic_midi.c

Creating object file for mios32_iic_bs.c

Creating object file for mios32_mf.c

Creating object file for mios32_sdcard.c

Creating object file for mios32_enc28j60.c

Creating object file for mios32_bsl.c

Creating object file for mios32_sys.c

Creating object file for mios32_irq.c

Creating object file for mios32_spi.c

Creating object file for mios32_i2s.c

Creating object file for mios32_board.c

Creating object file for mios32_timer.c

Creating object file for mios32_stopwatch.c

Creating object file for mios32_delay.c

Creating object file for mios32_ain.c

Creating object file for mios32_usb.c

Creating object file for mios32_usb_midi.c

Creating object file for mios32_usb_com.c

Creating object file for mios32_uart.c

Creating object file for mios32_iic.c

Creating object file for printf-stdarg.c

Creating object file for core_cm3.c

Creating object file for usbhw_lpc.c

Creating object file for usbcontrol.c

Creating object file for usbstdreq.c

Creating object file for usbinit.c

Creating object file for app_lcd.c

Creating object file for glcd_font_big.c

Creating object file for glcd_font_small.c

Creating object file for glcd_font_normal.c

Creating object file for glcd_font_knob_icons.c

Creating object file for glcd_font_meter_icons_h.c

Creating object file for glcd_font_meter_icons_v.c

Creating object file for uip.c

Creating object file for uip_arp.c

Creating object file for uiplib.c

Creating object file for psock.c

Creating object file for timer.c

Creating object file for uip-neighbor.c

Creating object file for memb.c

Creating object file for clock-arch.c

Creating object file for network-device.c

Creating object file for lpc17xx_emac.c

Creating object file for eeprom.c

Creating object file for mini_cpp.cpp

Creating object file for freertos_heap.cpp

project_build/presets.o: In function `PRESETS_StoreAll':

/Users/aaron/Documents/Projects/ArtNet Node/presets.c:96: undefined reference to `UIP_TASK_DHCP_EnableGet'

/Users/aaron/Documents/Projects/ArtNet Node/presets.c:97: undefined reference to `UIP_TASK_IP_AddressGet'

/Users/aaron/Documents/Projects/ArtNet Node/presets.c:98: undefined reference to `UIP_TASK_NetmaskGet'

/Users/aaron/Documents/Projects/ArtNet Node/presets.c:99: undefined reference to `UIP_TASK_GatewayGet'

project_build/presets.o: In function `PRESETS_Init':

/Users/aaron/Documents/Projects/ArtNet Node/presets.c:52: undefined reference to `UIP_TASK_InitFromPresets'

collect2: ld returned 1 exit status

make: *** [project_build/project.elf] Error 1

Aarons_Macbook_Pro-3:ArtNet Node aaron$

Link to comment
Share on other sites

Something else that I realized. The compile error I'm getting is not the one as if the functions are undeclared. I'm not getting the "implicit declaration of function" error, but the "undefined reference" error. I don't know what this means... Just thought I'd mention it.

Link to comment
Share on other sites

You have to include following file to get proper access over the UIP_TASK_* function declarations:


#include <uip_task.h>
[/code]

Once you did this, the compiler will also tell you if the UIP_TASK_InitFromPresets function is used correctly before linking.

Best Regards, Thorsten.

Link to comment
Share on other sites

I have already included my own uip_task.h file in the code that's giving me problems. I am going to modify some of the functions, so I need a local copy in my source folder. Even with both #include "uip_task.h" and #include <uip_task.h>, the compile still fails.

Link to comment
Share on other sites

I'm getting the same undefined reference error with a new piece of code. This is a new file, with 2 functions, its .h file is included in the app.c, and the error is now happening on those functions. I'm not seeing the files that are causing errors being compiled anywhere, and the .o files are missing from the build directory. Is there an include missing somewhere? What's going on here?

Edit: As a matter of fact, only 4 of the 9 sets of .c/.h files are showing up as .o/.d files in the build directory.

Edited by avockley
Link to comment
Share on other sites

I think that you are doing something wrong in the Makefile.

Actually the sources should be automatically added when the *.mk file of the appr. code module is included from the Makefile as shown in the tutorials.

Remote diagnosis is a bit difficult here, could you please type "make clean", zip the directory and attach it to this thread?

Best Regards, Thorsten.

Link to comment
Share on other sites

Here's the entire source directory and all the build files.

And here's the compiler log

Aaron-Vockleys-Laptop:ArtNet Node aaron$ make

rm -f project.hex

Creating object file for app.c

Creating object file for main.c

Creating object file for tasks.c

Creating object file for list.c

Creating object file for queue.c

Creating object file for port.c

Creating object file for umm_malloc.c

Creating object file for startup_LPC17xx.c

Creating object file for mios32_srio.c

Creating object file for mios32_din.c

Creating object file for mios32_dout.c

Creating object file for mios32_enc.c

Creating object file for mios32_lcd.c

Creating object file for mios32_midi.c

Creating object file for mios32_osc.c

Creating object file for mios32_com.c

Creating object file for mios32_uart_midi.c

Creating object file for mios32_iic_midi.c

Creating object file for mios32_iic_bs.c

Creating object file for mios32_mf.c

Creating object file for mios32_sdcard.c

Creating object file for mios32_enc28j60.c

Creating object file for mios32_bsl.c

Creating object file for mios32_sys.c

Creating object file for mios32_irq.c

Creating object file for mios32_spi.c

Creating object file for mios32_i2s.c

Creating object file for mios32_board.c

Creating object file for mios32_timer.c

Creating object file for mios32_stopwatch.c

Creating object file for mios32_delay.c

Creating object file for mios32_ain.c

Creating object file for mios32_usb.c

Creating object file for mios32_usb_midi.c

Creating object file for mios32_usb_com.c

Creating object file for mios32_uart.c

Creating object file for mios32_iic.c

Creating object file for printf-stdarg.c

Creating object file for core_cm3.c

Creating object file for usbhw_lpc.c

Creating object file for usbcontrol.c

Creating object file for usbstdreq.c

Creating object file for usbinit.c

Creating object file for app_lcd.c

Creating object file for glcd_font_big.c

Creating object file for glcd_font_small.c

Creating object file for glcd_font_normal.c

Creating object file for glcd_font_knob_icons.c

Creating object file for glcd_font_meter_icons_h.c

Creating object file for glcd_font_meter_icons_v.c

Creating object file for uip.c

Creating object file for uip_arp.c

Creating object file for uiplib.c

Creating object file for psock.c

Creating object file for timer.c

Creating object file for uip-neighbor.c

Creating object file for memb.c

Creating object file for clock-arch.c

Creating object file for network-device.c

Creating object file for lpc17xx_emac.c

Creating object file for eeprom.c

Creating object file for mini_cpp.cpp

Creating object file for freertos_heap.cpp

project_build/app.o: In function `APP_Init':

/Users/aaron/Documents/Projects/ArtNet Node/app.c:35: undefined reference to `PRESETS_Init'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:48: undefined reference to `UIP_TASK_IP_AddressGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:48: undefined reference to `UIP_TASK_IP_AddressGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:48: undefined reference to `UIP_TASK_IP_AddressGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:48: undefined reference to `UIP_TASK_IP_AddressGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:50: undefined reference to `UIP_TASK_NetmaskGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:50: undefined reference to `UIP_TASK_NetmaskGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:50: undefined reference to `UIP_TASK_NetmaskGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:50: undefined reference to `UIP_TASK_NetmaskGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:52: undefined reference to `UIP_TASK_GatewayGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:52: undefined reference to `UIP_TASK_GatewayGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:52: undefined reference to `UIP_TASK_GatewayGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:52: undefined reference to `UIP_TASK_GatewayGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:56: undefined reference to `INVERTER_Init'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:57: undefined reference to `DMX_Init'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:58: undefined reference to `DMX_Timer'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:58: undefined reference to `DMX_ByteTimer'

project_build/app.o: In function `APP_Background':

/Users/aaron/Documents/Projects/ArtNet Node/app.c:67: undefined reference to `UIP_TASK_IP_AddressGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:67: undefined reference to `UIP_TASK_IP_AddressGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:67: undefined reference to `UIP_TASK_IP_AddressGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:67: undefined reference to `UIP_TASK_IP_AddressGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:69: undefined reference to `UIP_TASK_NetmaskGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:69: undefined reference to `UIP_TASK_NetmaskGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:69: undefined reference to `UIP_TASK_NetmaskGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:69: undefined reference to `UIP_TASK_NetmaskGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:71: undefined reference to `UIP_TASK_GatewayGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:71: undefined reference to `UIP_TASK_GatewayGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:71: undefined reference to `UIP_TASK_GatewayGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:71: undefined reference to `UIP_TASK_GatewayGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:73: undefined reference to `UIP_TASK_IP_AddressGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:74: undefined reference to `UIP_TASK_IP_AddressGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:75: undefined reference to `UIP_TASK_IP_AddressGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:76: undefined reference to `UIP_TASK_IP_AddressGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:77: undefined reference to `UIP_TASK_NetmaskGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:78: undefined reference to `UIP_TASK_NetmaskGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:79: undefined reference to `UIP_TASK_NetmaskGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:80: undefined reference to `UIP_TASK_NetmaskGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:81: undefined reference to `UIP_TASK_GatewayGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:82: undefined reference to `UIP_TASK_GatewayGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:83: undefined reference to `UIP_TASK_GatewayGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:84: undefined reference to `UIP_TASK_GatewayGet'

/Users/aaron/Documents/Projects/ArtNet Node/app.c:84: undefined reference to `INVERTER_PrintNumber'

collect2: ld returned 1 exit status

make: *** [project_build/project.elf] Error 1

Aaron-Vockleys-Laptop:ArtNet Node aaron$

ArtNet Node.zip

Link to comment
Share on other sites

Ok, now I've a better picture about what you are doing:

you copied files from the $MIOS32_PATH/modules/uip_task_standard directory into your app directory and started to do modifications

Mainly you replaced the copyright notice of the original creator by your own name which is btw. not a fair programming style!

The Makefile enhancements of the uip_task_standard files are normally included with:


# UIP Standard Task (with DHCPC + OSC server and client)
include $(MIOS32_PATH)/modules/uip_task_standard/uip_task_standard.mk
[/code]

But for your own set of files, you've to add all "local" .c sources to the THUMB_SOURCE variable from your "local" Makefile - as you already noticed.

Otherwise they will neither be compiled, nor linked into the project.

Best Regards, Thorsten.

Link to comment
Share on other sites

The uip_task_standard files needed some modifications so that they would work for my purposes, mainly a branch in the udp appcall, so that I could handle the data coming to my app. I thought including them in the sources was enough to make the compiler recognize them.

BTW I did intend to change the copyright back to the original once I realized that only very minor modifications needed to be made. I just hadn't gotten around to it when I posted.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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...
 Share

×
×
  • Create New...