c 파일을 cpp 파일로 변환 할려고 하는데요..

facered79의 이미지

일단.. unsigned char 와 같은 type 관련된 오류를
다 잡아 주었는데..
다른 오류가 발생합니다. 아래와 같은데요

#/bin/sh ./libtool  --mode=link g++ -o Rshab Rshab.lo  libRshab.la -L./snmplib -L./agent -L./agent/helpers -Wl,--rpath -Wl,/usr/local/libxml2/lib ./agent/libnetsnmpagent.la ./agent/libnetsnmpmibs.la ./agent/helpers/libnetsnmphelpers.la ./snmplib/libnetsnmp.la  -ldl -lcrypto -lm -lpthread -lxml2  /usr/local/libxml2/lib/libxml2.so -lpthread -lz -lm -I/usr/local/libxml2/include/libxml2
/bin/sh ./libtool  --mode=link g++ -o Rshab Rshab.lo  libRshab.la -L./snmplib -L./agent -L./agent/helpers -Wl,--rpath -Wl,/usr/local/libxml2/lib ./agent/libnetsnmpagent.la ./agent/libnetsnmpmibs.la ./agent/helpers/libnetsnmphelpers.la ./snmplib/libnetsnmp.la  -ldl -lcrypto -lm -lpthread -lxml2  /usr/local/libxml2/lib/libxml2.so
g++ -o .libs/Rshab Rshab.o -Wl,--rpath -Wl,/usr/local/libxml2/lib /usr/local/libxml2/lib/libxml2.so  ./.libs/libRshab.so -L/home/facered/RFMB_PROJECT/RSHABv3.0/snmplib -L/home/facered/RFMB_PROJECT/RSHABv3.0/agent -L/home/facered/RFMB_PROJECT/RSHABv3.0/agent/helpers ./agent/.libs/libnetsnmpagent.so ./agent/.libs/libnetsnmpmibs.so ./agent/helpers/.libs/libnetsnmphelpers.so ./snmplib/.libs/libnetsnmp.so -ldl -lcrypto -lpthread /usr/lib/libxml2.so -lz -lm  -Wl,--rpath -Wl,/usr/local/net-snmp//lib -Wl,--rpath -Wl,/usr/local/net-snmp/lib
Rshab.o(.text+0xf4b): In function `trapd(void*)':
/home/facered/RFMB_PROJECT/RSHABv3.0/Rshab.cc:960: undefined reference to `init_subagent()'
Rshab.o(.text+0xf58):/home/facered/RFMB_PROJECT/RSHABv3.0/Rshab.cc:966: undefined reference to `init_register_usmUser_context(char const*)'
./.libs/libRshab.so: undefined reference to `run_exec_command(char*, char*, char*, int*)'
collect2: ld returned 1 exit status
make: *** [Rshab] 오류 1

물론.. c 파일을 컴파일 할때는 발생하지 않는 오류인데..
cpp로 바꾼 후에 나타납니다..

make file 내용은 아래와 같습니다.

#
# Minimum environment and virtual path setup
#
SHELL       = /bin/sh
top_srcdir  = .


#
# Paths
#
#exec_prefix    = /usr/local/net-snmp
#exec_prefix    = /home/facered/RFMB_PROJECT/RSHABv2.0
libdir      = ${exec_prefix}/lib

#
# Compiler arguments
#
CFLAGS      = -g -O2 -Dlinux
LIBTOOL     = $(SHELL) $(top_builddir)/libtool
# Misc Compiling Stuff
CC          = g++

#
LIBCURRENT  = 7
LIBAGE      = 2
LIBREVISION = 1

LIB_LD_CMD      = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) -rpath $(libdir) -version-info $(LIBCURRENT):$(LIBREVISION):$(LIBAGE) -o
LIB_EXTENSION   = la
LIB_VERSION     =
LIB_LDCONFIG_CMD = $(LIBTOOL) --mode=finish $(libdir)
LINK        = $(LIBTOOL) --mode=link $(CC)
# RANLIB    = ranlib
RANLIB      = :

# libtool definitions
.SUFFIXES: .cc .o .lo .rc
.cc.lo:
    $(LIBTOOL) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
.rc.lo:
    $(LIBTOOL) --mode=compile windres -o $@ $<

# include paths
#
#SRC_TOP_INCLUDES            = -I$(top_srcdir)/include -I/usr/local/libxml2/include/libxml2
SRC_TOP_INCLUDES            = -I$(top_srcdir)/include -I/usr/local/libxml2/include/libxml2
#SRC_TOP_INCLUDES            = -I/usr/local/libxml2/include/libxml2
SRC_SNMPLIB_INCLUDES        = -I$(top_srcdir)/snmplib
SRC_AGENT_INCLUDES          = -I$(top_srcdir)/agent
SRC_HELPER_INCLUDES         = -I$(top_srcdir)/agent/helpers
SRC_MIBGROUP_INCLUDES       = -I$(top_srcdir)/agent/mibgroup

TOP_INCLUDES            = $(SRC_TOP_INCLUDES)
SNMPLIB_INCLUDES        = $(SRC_SNMPLIB_INCLUDES)
AGENT_INCLUDES          = $(SRC_AGENT_INCLUDES)
HELPER_INCLUDES         = $(SRC_HELPER_INCLUDES)
MIBGROUP_INCLUDES       = $(SRC_MIBGROUP_INCLUDES)

전체적인 내용은 아니구요. 일부입니다..

왜 이런 오류가 발생하는것일까요..

해결을위한 방법에 대해 얘기를 나누고 싶습니다..

pynoos의 이미지

init_register_usmUser_context 가 선언된 헤더 파일에 흔히 있는

#ifdef __cplusplus
extern "C"{
#endif

와 같은 것이 없어서 그렇습니다.
디폴트로 C는 함수 이름만 보고 reference를 만들고 C++은 인자까지 보고 만들기 때문에 , C++ 컴파일러에게 이부분은 "C" 영역이다라고 알려줘야 reference를 만들때 인자를 무시하고 이름만 보고 만들게 됩니다.

댓글 달기

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