라이브러리를 사용하는데 undefined reference 오류가 발생합니다.

liush79의 이미지

금요일쯤 질문한번 했었는데 완료가 되지 않아 다시 정리 해서 올립니다.

퀄컴사의 한 라이브러리를 사용하려고 했는데 오류가 발생했습니다.

단지 인터페이스 선언만 했고요..소스는 다음과 같습니다.

#define QSCLGUID
#include <qscl.h>
#include <dlfcn.h>
 
int main(int argc, char** argv[])
{
    IQsclConvertFile *cf = reinterpret_cast<IQsclConvertFile *>(QsclCreateInstance(ID_QsclFile, ID_IQsclConvertFile));
 
    return 0;
}

이걸 컴파일 했더니 오류가 나는데 (std 관련)
feanor 님이 gcc 버전을 3.3으로 낮춰야 한다고 해서 버전을 낮췄습니다.
그랬더니 std 관련 오류는 모두 해결 됐는데요..

아직.. 다음오류가 납니다.

빌드는 다음과 같이 해보았습니다. (lqscl 은 퀄컴 라이브러리)
gcc test2.cpp -lqscl -lstdc++
gcc test2.cpp -lqscl -lstdc++ -lpthread

/usr/local/lib/gcc-lib/i386-redhat-linux/3.3/../../../libqscl.a(qsclCodecMulaw.o): In function `QsclCodecMulaw::QsclCodecMulaw[not-in-charge]()':
qsclCodecMulaw.cpp:(.text+0x43): undefined reference to `Mutex::Mutex[in-charge]()'
/usr/local/lib/gcc-lib/i386-redhat-linux/3.3/../../../libqscl.a(qsclCodecMulaw.o): In function `QsclCodecMulaw::QsclCodecMulaw[in-charge]()':
qsclCodecMulaw.cpp:(.text+0xac): undefined reference to `Mutex::Mutex[in-charge]()'
/usr/local/lib/gcc-lib/i386-redhat-linux/3.3/../../../libqscl.a(qsclCodecMulaw.o): In function `QsclCodecMulaw::~QsclCodecMulaw [not-in-charge]()':
qsclCodecMulaw.cpp:(.text+0x10c): undefined reference to `Mutex::freeMutex()'
/usr/local/lib/gcc-lib/i386-redhat-linux/3.3/../../../libqscl.a(qsclCodecMulaw.o): In function `QsclCodecMulaw::~QsclCodecMulaw [in-charge]()':
qsclCodecMulaw.cpp:(.text+0x163): undefined reference to `Mutex::freeMutex()'
/usr/local/lib/gcc-lib/i386-redhat-linux/3.3/../../../libqscl.a
....
 
중략
 
....
qsclFile.cpp:(.text+0xabc6): undefined reference to `MutexLock::lock()'
qsclFile.cpp:(.text+0xabe9): undefined reference to `MutexLock::unlock()'
/usr/local/lib/gcc-lib/i386-redhat-linux/3.3/../../../libqscl.a(qsclFile.o): In function `QsclFile::release()':
qsclFile.cpp:(.text+0xac16): undefined reference to `MutexLock::lock()'
qsclFile.cpp:(.text+0xac3d): undefined reference to `MutexLock::unlock()'
qsclFile.cpp:(.text+0xac69): undefined reference to `MutexLock::unlock()'
/usr/local/lib/gcc-lib/i386-redhat-linux/3.3/../../../libqscl.a(qsclFile.o):(.gnu.linkonce.d._ZTV8QsclFile+0x128): undefined reference to `ThreadedObject::workerThreadLoopCondition()'
/usr/local/lib/gcc-lib/i386-redhat-linux/3.3/../../../libqscl.a(qsclFile.o):(.gnu.linkonce.d._ZTI8QsclFile+0x38): undefined reference to `typeinfo for ThreadedObject'
collect2: ld returned 1 exit status

무슨 라이브러리가 빠진거 같은데..
어떤건지 모르겠습니다.

윈도버전과 리눅스 버전이 있고요..
윈도버전에서는 오류가 발생하지 않습니다.
리눅스에서 뭔가.. 링크하나가 안된거 같습니다.

좀 도와주십쇼 '_';

only2sea의 이미지

이거 제가 그 쪽 배경지식이 없어서 헛소리하는 것인지는 모르겠지만...
C++ 프로그램 아닌가요? MutexLock::lock() 이런 것으로 봐서요.
그러면 g++로 빌드 해야 되지 않나 싶습니다.
이름 맹글링 때문에 레퍼런스를 못 찾지 않은지요...

reinterpret_cast도 뒤에 템플릿 인자 부분이 웹이라서 짤린 것 같은데
#include 처럼 말이죠. 그렇다면 c++ 프로그램 같네요.

블로그: http://turtleforward.blogspot.com

liush79의 이미지

gcc 에 -lstdc++ 을 링크하면 g++ 과 동일하다고 들어서 위처럼 했고요..

g++ test2.cpp -lqscl -lpthread

처럼 해도 마찬가지 결과가 나옵니다.

관심을 가져주셔서 감사합니다 ㅜㅜ

only2sea의 이미지

앗, 그렇군요. 이거 참... 뭔가 라이브러리가 빠졌을 텐데 저것이 무언지...
으.. 성공하시길 빌겠습니다. 지나가는 고수님의 답을 기다리며...

블로그: http://turtleforward.blogspot.com

댓글 달기

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