Hello Scarphin,
Thanks for feedback.
Is there some other way to proceed ... i.e. without adding prefixes into header declarations.
The problem is that the hierarchy is quite complex and number of files to process is huge.
The makefile I used for compilation is very simple. Here it's contents:
DEFINES+=PROJECT_CONF_H=\"project-conf.h\"
CONTIKI_PROJECT = my_udp_client
all: $(CONTIKI_PROJECT)
CONTIKI = ../..
include $(CONTIKI)/Makefile.include
What is complex is Makefile.include. Its size is 8k and its syntax is quite complex - instructions, flags, compilations.
It is situated in the root of Contiki installation and obviously allows to circumvent the problem with header prefixes.
What keeps my attention - in initial project whole concerned staff (.c, .h) was added into so-called "virtual" folders (of green color) whereas in my new project I added all staff directly. In this last case the folders are of blue color.
Probably here is the key of enigme ?
Regards
Pavel.
I've created source in the project, that uses functions from files already included in project.
In the makefile I replaced older source par new one.
Apparently everything is Ok and new source should be compiled without problem.
But NOT !!! There is still this annoying error ... undefined reference. Here is build log fragment:
my_udp_client.c(.text.process_thread_udp_client_process+0xae) undefined reference to 'uip_ds6_set_addr_iid'
my_udp_client.c(.text.process_thread_udp_client_process+0xb8) undefined reference to 'uip_ds6_addr_add'
my_udp_client.c(.text.process_thread_udp_client_process+0x1b0) undefined reference to 'uip_ds6_if'
..\..\cpu\cc2538\Makefile.cc2538 70 recipe for target 'my_udp_client.elf' failed
=== Build failed: 4 error(s), 12 warning(s) (0 minute(s), 4 second(s)) ===
I checked object subfolder - where *.o and *.d filles are stocked. The object file uip-ds6.o (from where originated functions uip_ds6_set_addr_iid and uip_ds6_addr_add) does present in the object subfolder ...
What could signify these errors ? The builder (make.exe) cannot link these object ?
Cordially
Pavel
Here is "header part" of my source:
#include "contiki.h"
#include "lib/random.h"
#include "sys/ctimer.h"
#include "net/uip.h"
#include "net/uip-ds6.h"
#include "net/uip-udp-packet.h"
#include "sys/ctimer.h"
I think that they are correct otherwise there were errors, related to non-identified headers.
But there is no such errors.
Other argument: in another example, that is succesfully built and works, I also use #include "contiki.h".
As you can state, there is no path prefix before contiki.h despite of fact that contiki.h is situated upper in hierarchy than source and project files (also contiki.h isn't in the root directory of disc "C").
Also as I already told, .c file that contains functions (those that provoked built errors) is compiled ... I see corresponding object (.o file).
If my comprehension is correct - compiled file cannot be linked for some reason. Isn't it ?
Cordially
Pavel.
Hello Scarphin,
There is no any settings, related to ".o" files inside makefile. A propos, here it is:
DEFINES+=PROJECT_CONF_H=\"project-conf.h\"
CONTIKI_PROJECT = my_udp_client
all: $(CONTIKI_PROJECT)
CONTIKI = ../..
include $(CONTIKI)/Makefile.include
The "obj subfolder" (where all .o files are stocked) contains 293 items.
Among them there is .o file, where there are functions, that cannot be linked (those that provoke "undefined reference" errors).
The question that arises - what is particular in these functions, that they cannot be linked, while others (from other .o files) - YES.
Regards
Pavel.
At the bottom of Makefile there is a line:
CONTIKI = ../..
include $(CONTIKI)/Makefile.include
Here I didn't properly understand what "../.." means - current folder (the folder where is project file) ?
In this case how include $(CONTIKI)/Makefile.include does work - file Makefile.include is situated at the top of Contiki package ?
Nevertheless I'm sure that it does work, so probably "../.." points to the top of Contiki package (that in reality is: C:\Users\Pavel\Documents\Proj_EPFL\contiki-2.7\).
Strange ... it seems that placeholder "../" in windows points to the root directory, i.e. C:, isn't it ?
Anyway here is extract from Makefile.include:
include $(CONTIKI)/core/net/Makefile.uip
And here is contens of C:/Users/Pavel/Documents/Proj_EPFL/contiki-2.7/core/net/Makefile.uip:
NET = \
dhcpc.c \
hc.c \
nbr-table.c \
netstack.c \
packetbuf.c \
packetqueue.c \
psock.c \
queuebuf.c \
resolv.c \
sicslowpan.c \
simple-udp.c \
tcpdump.c \
tcpip.c \
uaodv-rt.c \
uaodv.c \
uip-debug.c \
uip-ds6-route.c \
uip-ds6-nbr.c \
uip-ds6.c \
uip-fw-drv.c \
uip-fw.c \
uip-icmp6.c \
uip-nd6.c \
uip-neighbor.c \
uip-over-mesh.c \
uip-packetqueue.c \
uip-split.c \
uip-udp-packet.c \
uip.c \
uip6.c \
uip_arp.c \
uiplib.c
As you can state inside of this list there is file "uip-ds6.c", that contains source code of functions
uip_ds6_set_addr_iid
uip_ds6_addr_add
Call of these functions (in the project source file) result "undefined reference" errors.
Next, I open uip-ds6.c in Code::Blocks and see that all the code is "pale", what probably means that code is ignored by due to #if statement (Am I correct ?).
The most external #if statement is:
#if UIP_CONF_IPV6
Then I go to my source and add the following line (in bold):
#include "contiki.h"
#include "lib/random.h"
#include "sys/ctimer.h"
#include "net/uip.h"
#define UIP_CONF_IPV6
#include "net/uip-ds6.h"
#include "net/uip-udp-packet.h"
#ifdef WITH_COMPOWER
As you can state it's included before #include "net/uip-ds6.h", so "define" should be accepted inside of uip-ds6.c.
But NOT !!!
After compiling there are still the same errors, also the code inside of uip-ds6.c is "pale".
I become crazy with all this staff ...