ftime() 함수 포함된 소스파일로 make 명령 실행시 오류가 발생합니다.

heisenjoy의 이미지

FreeBSD 8.2 환경에서 ftime() 함수가 포함된 소스파일을 make 명령 실행시 아래와 같은 오류 메시지가 출력됩니다.

[cshuap@users ~/paws]$ make
gcc -c -O2 client.c
gcc -o paws_client client.o -lm -O2
client.o(.text+0x25e4): In function `worm_infectee_scan':
: undefined reference to `ftime'
client.o(.text+0x2601): In function `worm_infectee_scan':
: undefined reference to `ftime'
client.o(.text+0x31b5): In function `main':
: undefined reference to `ftime'
client.o(.text+0x31fa): In function `main':
: undefined reference to `ftime'
*** Error code 1

ftime() 함수가 정의되지 않은 것으로 해석되는데, sys/timeb.h 헤더파일을 포함시켜 주어 timeb 구조체는 제대로 선언이 됨에도 불구하고 ftime() 함수만 정의되지 않습니다.
아래 소스로 설명드리겠습니다.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <netdb.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/timeb.h>
 
int main(int argc, char** argv)
{
  register u_int i, j, k, r, m, n;
  u_int uns;
  FILE *infile;
  char buf1[256], buf2[256], str[64];
  char *cptr1, *cptr2;
  struct timeb start_t, end_t;
  u_int *as_size;
  int i1, i2;
 
 //길어서 생략 합니다.
 
  ftime(&start_t); //simulation start time
  printf("_____________________________________________________\n");
  printf("Time\tInf\tUpdate\tDropped\tPassed\tBuffered_scans\n");
  i = 0;
  while (i < SIMULATION_DURATION) {
    worm_infectee_scan(i);
    i++;
  }
  ftime(&end_t);
  j = end_t.time*1000 + end_t.millitm - start_t.time*1000 - start_t.millitm;
  printf("Real time used on machine <%d>: %dh%dm%d\n", host_id, j/3600000, j%3600000/60000, j%60000/1000);
  printf("Total time used for communication: %dm%ds\n", com_time/60000, com_time/60000%1000);
  fflush(stdout);
}

보시면 start_t, end_t 는 오류없이 제대로 선언되는데 ftime() 함수가 정의되지 않았다고 하여 고민중에 있습니다.
어떤 분께 들은 말로는 sys/time.h 헤더를 사용해야한다고하는데, 이또한 마찬가지 였습니다.
벌써 몇일째 고민중에 있는데 어느부분을 의심해 보아야할지 도움 주신다면 감사하겠습니다.

heisenjoy의 이미지

client: client.o paws.h
        $(CC) $(LFLAG) paws_client client.o -lm -O2

댓글 달기

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
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.