c++ icnov함수 관련하여 도움이 필요합니다..

Nicode의 이미지

실제 파라미터로 전달될 str은 01 FF FE 4D 00 69 00 6E 00 61 00 72 00 27 00 73 00 20 00 44 00 72 00 65 00 61 00 6D 00 이런식 입니다.

이 데이터는 Mp3파일 포맷의 TIT2 프레임입니다.

맨 앞에 01은 뭔지 모르겟고.. FFFE는 BOM입니다. (맨앞에 01은 무엇을 의미하는 바이트 인지 ...)

그 이후부터는 음악 제목입니다.

utf - 16 리틀 엔디안으로 인코딩 되어있습니다..

이를 utf-8로 인코딩하기 위한 함수입니다..

#include <iostream>
#include <iconv.h>
 
std::string utf16le_to_utf8(char *str, unsigned long len)
{
    size_t outbuflen = len * 2;
    char *outbuf = new char[outbuflen];
    iconv_t iconv_eng = ::iconv_open("UTF-8", "UTF-16LE"); // utf16 리틀 엔디안을 utf8로 변환
    if (reinterpret_cast< ::iconv_t>(-1) == iconv_eng)
    {
        std::cerr << "Unable to create ICONV engine: " << strerror(errno) << std::endl;
        return "fail";
    }
    size_t cc = iconv(iconv_eng, &str, &len, &outbuf, &outbuflen);
    return outbuf;
}

위 코드를 빌드하면

// Undefined symbols for architecture arm64:
// "_iconv", referenced from:
// utf16le_to_utf8(char*, unsigned long) in iconvTest-8c3ce7.o
// "_iconv_open", referenced from:
// utf16le_to_utf8(char*, unsigned long) in iconvTest-8c3ce7.o
// "_main", referenced from:
// implicit entry/start for main executable
// ld: symbol(s) not found for architecture arm64
// clang: error: linker command failed with exit code 1 (use -v to see invocation)

이와 같은 에러메시지를 뱉습니다.

맨 아래는 그냥 메인함수가 없다는 에러 같고,,

함수 심볼? 을 찾을수 없다는 에러 같습니다.

에러의 원인에 대해 도움이 필요합니다..

환경은 이렇습니다.

맥북 에어 m1 빅서 11.4

vscode 사용중이고 c/c++확장과 코드러너 사용중입니다.

xcode를 설치한 상태입니다.(설치만 해놓고 안씁니다)

어떤 이유로 함수 정의를 못찾는거같은데.. 링크 과정에서 에러가 나는듯하고..

swish95의 이미지

------------------------------------------------------------
ProgrammingHolic

댓글 달기

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