collet2 (gate.c:(.text+0x65): undefined reference to `function') 함수 링크 오류

unuseid의 이미지

기존 프로젝트에 새 c,h 파일을 추가 했는데 링크 단계에서 오류가 납니다
어디가 잘못된 걸까요?

gate.o: In function 'gate_funtion':
gate.c : (.text+0x45): undefined reference to 'regi_start'
collect2: error: ld returned 1 exit status

새로추가한 gate.c 는 함수내에서기존에 있는 파일인 regi.c에 있는 함수를 사용합니다.
regi.c의 함수의 선언은 다른 c파일들의 함수선언들과 함께 internals.h에 있습니다

main.c는 gate.h와 internals.h를 include 했습니다.
internal에 선언 돼 있는 다른 c파일(regi.c 포함)의 함수들은 main에서 잘 작동 합니다.
gate.c는 internals.h에 선언된 상수는 이상없이 함수를 통해 출력 할 수 있습니다.

아래는 Makefile 과 폴더의 구조입니다

CC = gcc -g -ggdb
LD = gcc -g -ggdb
 
#CC = arm-none-linux-gnueabi-gcc
#LD = arm-none-linux-gnueabi-gcc
 
 
SRCDIR1 = core
SRCDIR2 = core/A
SRCDIR3 = examples/A
SRCDIR4 = examples/B
SRCDIR5 = examples/C
 
VPATH = $(SRCDIR1) $(SRCDIR2) $(SRCDIR3) $(SRCDIR4) $(SRCDIR5)
 
#CFLAGS = -O2 -I$(SRCDIR1) -I$(SRCDIR2) -I$(SRCDIR3) -I$(SRCDIR4) -DLWM2M_LITTLE_ENDIAN -DLWM2M_WITH_LOGS -DLWM2M_SERVER_MODE -DDEBUG
CFLAGS = -O2 -I$(SRCDIR1) -I$(SRCDIR2) -I$(SRCDIR3) -I$(SRCDIR4) -I$(SRCDIR5) -DLWM2M_LITTLE_ENDIAN -DLWM2M_WITH_LOGS -DLWM2M_CLIENT_MODE -DLWM2M_BOOTSTRAP -std=gnu99 -lpthread
 
LDFLAGS = -lpthread
 
TARGET = lwm2mclient
 
SRCS = $(foreach dir, .. $(SRCDIR1) $(SRCDIR2) $(SRCDIR3) $(SRCDIR4) $(SRCDIR5), $(wildcard $(dir)/*.c))
SRCS := $(notdir $(SRCS))
 
OBJS = $(SRCS:.c=.o)
 
 
all: $(TARGET)
 
$(TARGET): $(OBJS)
	$(LD) $^ -lm -o $(TARGET) 
 
%o:%c
	$(CC) $(CFLAGS) -c $< -o $@
 
clean:
	-rm -f $(OBJS)
	-rm -f $(TARGET)
 
depend: $(SRCS)
	$(CC) -M $(CFLAGS) $^ > $@
 
-include depend
File attachments: 
첨부파일 크기
Image icon 캡처.PNG12.71 KB

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.