在 Contiki 3.0 中编译代码时出现对 `LOG_INFO' 错误的未定义引用

问题描述 投票:0回答:1

我正在尝试在 Contiki-3.0 中编译此代码:

#include "contiki.h"
#include "net/netstack.h"
#include "net/ip/uip.h"
#include "net/ipv6/uip-ds6.h"
#include "sys/etimer.h"
#include "sys/ctimer.h"
#include "sys/log.h"
#include "random.h"
#include "net/rpl/rpl.h"

#define LOG_MODULE "App"
#define LOG_LEVEL LOG_LEVEL_INFO

static struct etimer periodic_timer;
static struct ctimer send_timer;
static uint16_t packets_sent = 0;
static uint16_t packets_received = 0;
static uint16_t overhead_packets = 0;
static clock_time_t delay_sum = 0;
static clock_time_t packet_time; // Define packet_time

PROCESS(node_process, "Node Process");
AUTOSTART_PROCESSES(&node_process);

static void send_packet(void *ptr) {
  packets_sent++;
  LOG_INFO("Sending packet %u\n", packets_sent);

  /* Your packet sending logic here */
  packet_time = clock_time(); // Set packet_time when sending the packet

  // For overhead, simulate control packets being sent periodically
  if(random_rand() % 2 == 0) {
    overhead_packets++;
  }

  // Schedule next send
  ctimer_reset(&send_timer);
}

static void packet_received(void) {
  packets_received++;
  clock_time_t delay = clock_time() - packet_time;
  delay_sum += delay;

  LOG_INFO("Packet received with delay %lu ms\n", (1000 * delay) / CLOCK_SECOND);
}

PROCESS_THREAD(node_process, ev, data)
{
  PROCESS_BEGIN();

  etimer_set(&periodic_timer, CLOCK_SECOND * 60);
  ctimer_set(&send_timer, CLOCK_SECOND * 5, send_packet, NULL);

  while(1) {
    PROCESS_WAIT_EVENT();

    if(etimer_expired(&periodic_timer)) {
      // Log metrics
      LOG_INFO("PDR: %u%%\n", (100 * packets_received) / packets_sent);
      LOG_INFO("Average end-to-end delay: %lu ms\n", (1000 * delay_sum) / packets_received / CLOCK_SECOND);
      LOG_INFO("Overhead packets: %u\n", overhead_packets);

      // Reset timer
      etimer_reset(&periodic_timer);
    }
  }

  PROCESS_END();
}

我遇到了一个错误:


> make my_node.sky TARGET=sky 
mkdir obj_sky
  CC        ../../platform/sky/./contiki-sky-platform.c
  CC        ../../dev/sht11/sht11.c
../../dev/sht11/sht11.c: In function ‘sht11_init’:
../../dev/sht11/sht11.c:218:4: warning: #warning SHT11: DISABLING I2C BUS [-Wcpp]
  CC        ../../dev/sht11/sht11-sensor.c
  CC        ../../platform/sky/dev/light-sensor.c
  CC        ../../platform/sky/dev/battery-sensor.c
  CC        ../../platform/sky/dev/button-sensor.c
  CC        ../../platform/sky/dev/radio-sensor.c
  CC        ../../cpu/msp430/f1xxx/spi.c
  CC        ../../dev/ds2411/ds2411.c
  CC        ../../platform/sky/dev/xmem.c
  CC        ../../platform/sky/dev/i2c.c
  CC        ../../platform/sky/./node-id.c
  CC        ../../core/lib/sensors.c
  CC        ../../core/cfs/cfs-coffee.c
  CC        ../../dev/cc2420/cc2420.c
../../dev/cc2420/cc2420.c:528:3: warning: initialization from incompatible pointer type [enabled by default]
../../dev/cc2420/cc2420.c:528:3: warning: (near initialization for ‘cc2420_aes_128_driver.set_key’) [enabled by default]
../../dev/cc2420/cc2420.c: In function ‘cc2420_transmit’:
../../dev/cc2420/cc2420.c:659:24: warning: variable ‘sfd_timestamp’ set but not used [-Wunused-but-set-variable]
  CC        ../../cpu/msp430/./cc2420-arch.c
  CC        ../../cpu/msp430/./cc2420-arch-sfd.c
../../cpu/msp430/./cc2420-arch-sfd.c: In function ‘cc2420_timerb1_interrupt’:
../../cpu/msp430/./cc2420-arch-sfd.c:44:7: warning: variable ‘tbiv’ set but not used [-Wunused-but-set-variable]
  CC        ../../platform/sky/dev/sky-sensors.c
  CC        ../../cpu/msp430/./uip-ipchksum.c
  CC        ../../cpu/msp430/f1xxx/uart1.c
  CC        ../../cpu/msp430/./slip_uart1.c
  CC        ../../cpu/msp430/dev/uart1-putchar.c
  CC        ../../core/lib/me.c
  CC        ../../core/lib/me_tabs.c
  CC        ../../core/dev/slip.c
  CC        ../../core/lib/crc16.c
  CC        ../../cpu/msp430/f1xxx/msp430.c
  CC        ../../cpu/msp430/./flash.c
  CC        ../../cpu/msp430/f1xxx/clock.c
  CC        ../../core/dev/leds.c
  CC        ../../cpu/msp430/./leds-arch.c
  CC        ../../cpu/msp430/./watchdog.c
  CC        ../../cpu/msp430/./lpm.c
  CC        ../../cpu/msp430/./mtarch.c
  CC        ../../cpu/msp430/f1xxx/rtimer-arch.c
  CC        ../../core/loader/elfloader.c
  CC        ../../core/loader/elfloader-msp430.c
  CC        ../../core/loader/symtab.c
  CC        ../../core/net/rpl/rpl-icmp6.c
  CC        ../../core/net/rpl/rpl-of0.c
  CC        ../../core/net/rpl/rpl-dag.c
  CC        ../../core/net/rpl/rpl-timers.c
  CC        ../../core/net/rpl/rpl-ext-header.c
  CC        ../../core/net/rpl/rpl.c
  CC        ../../core/net/rpl/rpl-mrhof.c
  CC        ../../core/net/rpl/rpl-dag-root.c
  CC        ../../core/net/ip/slipdev.c
  CC        ../../core/net/ip/dhcpc.c
  CC        ../../core/net/ip/uip-packetqueue.c
  CC        ../../core/net/ip/tcp-socket.c
  CC        ../../core/net/ip/uip-debug.c
  CC        ../../core/net/ip/ip64-addr.c
  CC        ../../core/net/ip/uip-udp-packet.c
  CC        ../../core/net/ip/psock.c
  CC        ../../core/net/ip/tcpip.c
  CC        ../../core/net/ip/resolv.c
  CC        ../../core/net/ip/uip-nameserver.c
  CC        ../../core/net/ip/uip-split.c
  CC        ../../core/net/ip/udp-socket.c
  CC        ../../core/net/ip/simple-udp.c
  CC        ../../core/net/ip/uiplib.c
  CC        ../../core/sys/ctimer.c
  CC        ../../core/sys/autostart.c
  CC        ../../core/sys/energest.c
  CC        ../../core/sys/arg.c
  CC        ../../core/sys/stimer.c
  CC        ../../core/sys/etimer.c
  CC        ../../core/sys/compower.c
  CC        ../../core/sys/process.c
  CC        ../../core/sys/rtimer.c
  CC        ../../core/sys/mt.c
  CC        ../../core/sys/procinit.c
  CC        ../../core/sys/timer.c
  CC        ../../core/dev/serial-line.c
  CC        ../../core/dev/nullradio.c
  CC        ../../core/lib/settings.c
  CC        ../../core/lib/ifft.c
  CC        ../../core/lib/ringbuf.c
  CC        ../../core/lib/mmem.c
  CC        ../../core/lib/ccm-star.c
  CC        ../../core/lib/list.c
  CC        ../../core/lib/aes-128.c
  CC        ../../core/lib/trickle-timer.c
  CC        ../../core/lib/print-stats.c
  CC        ../../core/lib/memb.c
  CC        ../../core/lib/petsciiconv.c
  CC        ../../core/lib/gcr.c
  CC        ../../core/lib/assert.c
  CC        ../../core/lib/random.c
  CC        ../../core/net/ipv6/uip-icmp6.c
  CC        ../../core/net/ipv6/uip-ds6.c
  CC        ../../core/net/ipv6/uip-ds6-route.c
  CC        ../../core/net/ipv6/uip6.c
  CC        ../../core/net/ipv6/uip-ds6-nbr.c
  CC        ../../core/net/ipv6/uip-nd6.c
  CC        ../../core/net/ipv6/sicslowpan.c
  CC        ../../core/net/mac/nullmac.c
  CC        ../../core/net/mac/nullrdc-noframer.c
  CC        ../../core/net/mac/mac-sequence.c
  CC        ../../core/net/mac/nullrdc.c
  CC        ../../core/net/mac/framer-802154.c
  CC        ../../core/net/mac/frame802154.c
  CC        ../../core/net/mac/framer-nullmac.c
  CC        ../../core/net/mac/mac.c
  CC        ../../core/net/mac/csma.c
  CC        ../../core/net/mac/phase.c
  CC        ../../core/net/mac/framer.c
  CC        ../../core/net/queuebuf.c
  CC        ../../core/net/nbr-table.c
  CC        ../../core/net/packetbuf.c
  CC        ../../core/net/netstack.c
  CC        ../../core/net/linkaddr.c
  CC        ../../core/net/mac/contikimac/contikimac.c
  CC        ../../core/net/mac/contikimac/contikimac-framer.c
  CC        ../../core/net/mac/cxmac/cxmac.c
  CC        ../../core/net/llsec/nullsec.c
  CC        ../../core/net/llsec/anti-replay.c
  CC        ../../core/net/llsec/ccm-star-packetbuf.c
  CC        ../../core/net/llsec/noncoresec/noncoresec.c
  CC        symbols.c
  AR        contiki-sky.a
  CC        my_node.c
my_node.c: In function ‘send_packet’:
my_node.c:27:3: warning: implicit declaration of function ‘LOG_INFO’ [-Wimplicit-function-declaration]
my_node.c: At top level:
my_node.c:41:13: warning: ‘packet_received’ defined but not used [-Wunused-function]
  CC        ../../platform/sky/./contiki-sky-main.c
  LD        my_node.sky
my_node.co: In function `send_packet':
/home/user/contiki-3.0/examples/my_node/my_node.c:39: undefined reference to `LOG_INFO'
/home/user/contiki-3.0/examples/my_node/my_node.c:39: undefined reference to `LOG_INFO'
/home/user/contiki-3.0/examples/my_node/my_node.c:39: undefined reference to `LOG_INFO'
/home/user/contiki-3.0/examples/my_node/my_node.c:27: undefined reference to `LOG_INFO'
collect2: ld returned 1 exit status
../../Makefile.include:280: recipe for target 'my_node.sky' failed
make: *** [my_node.sky] Error 1
Process returned error code 2
rm my_node.co obj_sky/contiki-sky-main.o

这是我的Makefile的内容:

CONTIKI_PROJECT = my_node
all: $(CONTIKI_PROJECT)

CONTIKI = ../..

# Include necessary modules
MODULES += core/net/rpl
MODULES += core/net/ip

# Add these lines to ensure logging is enabled
CFLAGS += -DLOG_CONF_LEVEL_RPL=LOG_LEVEL_INFO
CFLAGS += -DLOG_CONF_LEVEL_TCPIP=LOG_LEVEL_INFO
CFLAGS += -DLOG_CONF_LEVEL_IPV6=LOG_LEVEL_INFO
CFLAGS += -DLOG_CONF_LEVEL_MAC=LOG_LEVEL_INFO
CFLAGS += -DLOG_CONF_LEVEL_FRAMER=LOG_LEVEL_INFO
CFLAGS += -DLOG_CONF_LEVEL_APP=LOG_LEVEL_INFO

include $(CONTIKI)/Makefile.include

以及Contiki-3.0的默认Makefile.include:

# -*- makefile -*-

ifndef CONTIKI
  ${error CONTIKI not defined! You must specify where Contiki resides}
endif

ifeq ($(TARGET),)
  -include Makefile.target
  ifeq ($(TARGET),)
    ${info TARGET not defined, using target 'native'}
    TARGET=native
  else
    ${info using saved target '$(TARGET)'}
  endif
endif

ifeq ($(DEFINES),)
  -include Makefile.$(TARGET).defines
  ifneq ($(DEFINES),)
    ${info using saved defines '$(DEFINES)'}
  endif
endif

ifndef HOST_OS
  ifeq ($(OS),Windows_NT)
  ## TODO: detect more specific Windows set-ups,
  ## e.g. CygWin, MingW, VisualC, Watcom, Interix
    HOST_OS := Windows
  else
    HOST_OS := $(shell uname)
  endif
endif

#More debug information when running in CI
ifdef CI
  ifeq ($(CI),true)
    V = 1
  endif
endif

usage:
    @echo "make MAKETARGETS... [TARGET=(TARGET)] [savetarget] [targets]"

targets:
    @ls -1 $(CONTIKI)/platform $(TARGETDIRS) | grep -v CVS

savetarget:
    -@rm -f Makefile.target
    @echo "saving Makefile.target"
    @echo >Makefile.target "TARGET = $(TARGET)"

savedefines:
    -@rm -f Makefile.$(TARGET).defines
    @echo "saving Makefile.$(TARGET).defines"
    @echo >Makefile.$(TARGET).defines "DEFINES = $(DEFINES)"

OBJECTDIR = obj_$(TARGET)

LOWERCASE = -abcdefghijklmnopqrstuvwxyz
UPPERCASE = _ABCDEFGHIJKLMNOPQRSTUVWXYZ
TARGET_UPPERCASE := ${strip ${shell echo $(TARGET) | sed y!$(LOWERCASE)!$(UPPERCASE)!}}
CFLAGS += -DCONTIKI=1 -DCONTIKI_TARGET_$(TARGET_UPPERCASE)=1

MODULES += core/sys core/dev core/lib

# Include IPv6, IPv4, and/or Rime

HAS_STACK = 0
ifeq ($(CONTIKI_WITH_IPV4),1)
  HAS_STACK = 1
  CFLAGS += -DNETSTACK_CONF_WITH_IPV4=1
  MODULES += core/net/ipv4 core/net/ip
endif

ifeq ($(CONTIKI_WITH_RIME),1)
  HAS_STACK = 1
  CFLAGS += -DNETSTACK_CONF_WITH_RIME=1 
  MODULES += core/net/rime
endif

# Make IPv6 the default stack
ifeq ($(HAS_STACK),0)
ifneq ($(CONTIKI_WITH_IPV6),0)
CONTIKI_WITH_IPV6 = 1
endif
endif

ifeq ($(CONTIKI_WITH_IPV6),1)
  CFLAGS += -DNETSTACK_CONF_WITH_IPV6=1
  ifneq ($(CONTIKI_WITH_RPL),0)
    CONTIKI_WITH_RPL = 1
  endif
  MODULES += core/net/ipv6 core/net/ip
endif

ifeq ($(CONTIKI_WITH_RPL),1)
    CFLAGS += -DUIP_CONF_IPV6_RPL=1
    MODULES += core/net/rpl
else
    CFLAGS += -DUIP_CONF_IPV6_RPL=0
endif

CONTIKI_SOURCEFILES += $(CONTIKIFILES)

CONTIKIDIRS += ${addprefix $(CONTIKI)/core/,dev lib net net/llsec net/mac net/rime \
                 net/rpl sys cfs ctk lib/ctk loader . }

oname = ${patsubst %.c,%.o,${patsubst %.S,%.o,$(1)}}

CONTIKI_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(CONTIKI_SOURCEFILES)}}

PROJECT_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(PROJECT_SOURCEFILES)}}

# Provide way to create $(OBJECTDIR) if it has been removed by make clean
$(OBJECTDIR):
    mkdir $@

uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))

### Include application makefiles

ifdef APPS
  APPDS = ${wildcard ${foreach DIR, $(APPDIRS), ${addprefix $(DIR)/, $(APPS)}}} \
             ${wildcard ${addprefix $(CONTIKI)/apps/, $(APPS)} \
             ${addprefix $(CONTIKI)/platform/$(TARGET)/apps/, $(APPS)} \
             $(APPS)}
  APPINCLUDES = ${foreach APP, $(APPS), ${wildcard ${foreach DIR, $(APPDS), $(DIR)/Makefile.$(APP)}}}
  -include $(APPINCLUDES)
  APP_SOURCES = ${foreach APP, $(APPS), $($(APP)_src)}
  DSC_SOURCES = ${foreach APP, $(APPS), $($(APP)_dsc)}
  CONTIKI_SOURCEFILES += $(APP_SOURCES) $(DSC_SOURCES)
endif

### Include target makefile (TODO Unsafe?)

target_makefile := $(wildcard $(CONTIKI)/platform/$(TARGET)/Makefile.$(TARGET) ${foreach TDIR, $(TARGETDIRS), $(TDIR)/$(TARGET)/Makefile.$(TARGET)})

# Check if the target makefile exists, and create the object directory if necessary.
ifeq ($(strip $(target_makefile)),)
  ${error The target platform "$(TARGET)" does not exist (maybe it was misspelled?)}
else
  ifneq (1, ${words $(target_makefile)})
    ${error More than one TARGET Makefile found: $(target_makefile)}
  endif
  include $(target_makefile)
endif

ifdef MODULES
  UNIQUEMODULES = $(call uniq,$(MODULES))
  MODULEDIRS = ${wildcard ${addprefix $(CONTIKI)/, $(UNIQUEMODULES)}}
  MODULES_SOURCES = ${foreach d, $(MODULEDIRS), ${subst ${d}/,,${wildcard $(d)/*.c}}}
  CONTIKI_SOURCEFILES += $(MODULES_SOURCES)
  APPDS += $(MODULEDIRS)
endif

### Verbosity control. Use  make V=1  to get verbose builds.

ifeq ($(V),1)
  TRACE_CC =
  TRACE_LD =
  TRACE_AR =
  TRACE_AS =
  Q=
else
  TRACE_CC = @echo "  CC       " $<
  TRACE_LD = @echo "  LD       " $@
  TRACE_AR = @echo "  AR       " $@
  TRACE_AS = @echo "  AS       " $<
  Q=@
endif

### Forward comma-separated list of arbitrary defines to the compiler

COMMA := ,
CFLAGS += ${addprefix -D,${subst $(COMMA), ,$(DEFINES)}}

### Setup directory search path for source and header files

CONTIKI_TARGET_DIRS_CONCAT = ${addprefix ${dir $(target_makefile)}, \
                               $(CONTIKI_TARGET_DIRS)}
CONTIKI_CPU_DIRS_CONCAT    = ${addprefix $(CONTIKI_CPU)/, \
                               $(CONTIKI_CPU_DIRS)}

SOURCEDIRS = . $(PROJECTDIRS) $(CONTIKI_TARGET_DIRS_CONCAT) \
             $(CONTIKI_CPU_DIRS_CONCAT) $(CONTIKIDIRS) $(APPDS) ${dir $(target_makefile)}

vpath %.c $(SOURCEDIRS)
vpath %.S $(SOURCEDIRS)

CFLAGS += ${addprefix -I,$(SOURCEDIRS) $(CONTIKI)}

### Check for a git repo and pass version if found
### git.exe in Windows cmd shells may require no stderr redirection
ifndef RELSTR
RELSTR:=${shell git --git-dir ${CONTIKI}/.git describe --tags --always}
endif

ifneq ($(RELSTR),)
CFLAGS += -DCONTIKI_VERSION_STRING=\"Contiki-$(RELSTR)\"
endif

### Automatic dependency generation

ifneq ($(MAKECMDGOALS),clean)
-include ${addprefix $(OBJECTDIR)/,$(CONTIKI_SOURCEFILES:.c=.d) \
                                   $(PROJECT_SOURCEFILES:.c=.d)}
endif

### See http://make.paulandlesley.org/autodep.html#advanced

define FINALIZE_DEPENDENCY
cp $(@:.o=.d) $(@:.o=.$$$$); \
sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
    -e '/^$$/ d' -e 's/$$/ :/' < $(@:.o=.$$$$) >> $(@:.o=.d); \
rm -f $(@:.o=.$$$$)
endef

clean:
    -rm -f *~ *core core *.srec \
    *.lst *.map \
    *.cprg *.bin *.data contiki*.a *.firmware core-labels.S *.ihex *.ini \
    *.ce *.co
    rm -rf $(CLEAN)
    -rm -rf $(OBJECTDIR)

distclean: clean
    -rm -f ${addsuffix .$(TARGET),$(CONTIKI_PROJECT)}

-include $(CONTIKI)/platform/$(TARGET)/Makefile.customrules-$(TARGET)

ifndef CUSTOM_RULE_C_TO_CE
%.ce: %.c
    $(TRACE_CC)
    $(Q)$(CC) $(CFLAGS) -DAUTOSTART_ENABLE -c $< -o $@
    $(STRIP) --strip-unneeded -g -x $@
endif

ifndef CUSTOM_RULE_C_TO_OBJECTDIR_O
$(OBJECTDIR)/%.o: %.c | $(OBJECTDIR)
    $(TRACE_CC)
    $(Q)$(CC) $(CFLAGS) -MMD -c $< -o $@
    @$(FINALIZE_DEPENDENCY)
endif

ifndef CUSTOM_RULE_S_TO_OBJECTDIR_O
$(OBJECTDIR)/%.o: %.S | $(OBJECTDIR)
    $(TRACE_AS)
    $(Q)$(AS) $(ASFLAGS) -o $@ $<
endif

ifndef CUSTOM_RULE_C_TO_O
%.o: %.c
    $(TRACE_CC)
    $(Q)$(CC) $(CFLAGS) -c $< -o $@
endif


ifndef CUSTOM_RULE_C_TO_CO
%.co: %.c
    $(TRACE_CC)
    $(Q)$(CC) $(CFLAGS) -DAUTOSTART_ENABLE -c $< -o $@
endif

ifndef AROPTS
  AROPTS = rcf
endif

ifndef CUSTOM_RULE_ALLOBJS_TO_TARGETLIB
contiki-$(TARGET).a: $(CONTIKI_OBJECTFILES)
    $(TRACE_AR)
    $(Q)$(AR) $(AROPTS) $@ $^
endif

ifndef LD
  LD = $(CC)
endif

ifndef CUSTOM_RULE_LINK
%.$(TARGET): %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a
    $(TRACE_LD)
    $(Q)$(LD) $(LDFLAGS) $(TARGET_STARTFILES) ${filter-out %.a,$^} \
        ${filter %.a,$^} $(TARGET_LIBFILES) -o $@
endif

%.ramprof: %.$(TARGET)
    $(NM) -S -td --size-sort $< | grep -i " [abdrw] " | cut -d' ' -f2,4

%.flashprof: %.$(TARGET)
    $(NM) -S -td --size-sort $< | grep -i " [t] " | cut -d' ' -f2,4

# Don't treat %.$(TARGET) as an intermediate file because it is
# in fact the primary target.
.PRECIOUS: %.$(TARGET)

# Cancel the predefined implict rule for compiling and linking
# a single C source into a binary to force GNU make to consider
# the match-anything rule below instead.
%: %.c

# Match-anything pattern rule to allow the project makefiles to
# abstract from the actual binary name. It needs to contain some
# command in order to be a rule, not just a prerequisite.
%: %.$(TARGET)
    @

请帮我解决问题。

我正在尝试在 Cooja 的 mote 上编译代码。该代码将负责收集数据:数据包传送率的影响、平均端到端延迟的影响以及开销数据包的影响。

simulation contiki cooja rpl
1个回答
0
投票

我相信您正在使用 Contiki-NG 日志记录方法来实现 Contiki-OS。我们可以使用 LOG_ 方法族(

LOG_INFO()
LOG_ERR()
等)作为 Contiki-NG 支持的基本功能。您可以查看Contiki-NG 日志系统文档了解更多信息。我相信这种支持只是在 Contiki 3.0 到 NG 之间的过渡中添加的,因为 3.0 源代码 缺少日志记录功能
core/sys

在 Contiki 3.0 的 Cooja 的 Mote Output 窗口中打印消息的最简单方法是经典的

printf()
。 Contiki 3.0 还涉足了带有
core/net/ip/uip-debug.h
的日志记录方法,尽管它通常仅用于打印包含 IPv6 和链路层地址的消息。您可以了解更多详细信息,并在 UDP IPv6 示例中查看示例,因为它使用 uip-debug 日志记录方法。

提醒一下,您必须正确包含并定义您要使用的方法:

对于 printf:

#include <stdio.h>

对于 uIP 打印消息(

MODE
可以是
DEBUG_NONE
DEBUG_PRINT
DEBUG_ANNOTATE
DEBUG_FULL
,具体取决于您的需要):

#define DEBUG MODE 
#include "net/ip/uip-debug.h"
© www.soinside.com 2019 - 2024. All rights reserved.