[질문] HP에서 스레드.. -_-

bizzare의 이미지

HP에서 스레드를 이용한 프로그램을 짜고 있습니다.

그런데, -lpthread 를 컴파일시에 넣지 않았을 경우에는 프로그램이 잘 실행되고, 다만 pthread_create 함수에서 에러가 리턴될 뿐이었습니다.

그런데 -lpthread를 옵션으로 넣고 빌드하고나니
프로그램을 실행하면 곧바로 에러가 나더군요. T_T

보통 어떤 경우에 이런 문제가 발생하는지요 -_-;;;

익명 사용자의 이미지

HP-UX 버전
컴파일러 버전
정도는 알려주셔야..

spacelee의 이미지

hpux에서 man pthread 해보시면

cc -D_POSIX_C_SOURCE=199506L -o myapp myapp.c -lpthread

와 같이 소스의 표준 버젼을 명기하라고 되어 있네요.

예전에는 -D_REENTRANT도 넣었어야 됐는데
그건 obsolete됐다고 나오goo요.

man pthread를 잘 읽어보심이..

권위를 의심할 것,어긋남을 존경할 것,자리잡기를 거부할 것,항상 자신을 재창조할 것 - MIT 미디어랩 -

bizzare의 이미지

-D_POSIX_C_SOURCE=199506L 옵션을 넣으니 다음과 같은 에러가 나더군요. 혹시 뭘 추가로 정의해 줘야 하는 것은 아닌지요.

Error 419: "/usr/include/sys/procset.h", line 84 # 'id_t' is used as a type,
but has not been defined as a type.
id_t p_lid;
^^^^
Error 419: "/usr/include/sys/procset.h", line 91 # 'id_t' is used as a type,
but has not been defined as a type.
id_t p_rid;
^^^^
Error 419: "/usr/include/sys/procset.h", line 103 # 'id_t' is used as a type,
but has not been defined as a type.
extern int sigsend(idtype_t, id_t, int);
^^^^
Error 419: "/usr/include/sys/procset.h", line 113 # 'id_t' is used as a type,
but has not been defined as a type.
extern int sigsend(idtype_t, id_t, int);
^^^^
Error 419: "/usr/include/sys/pset.h", line 186 # 'spu_t' is used as a type,
but has not been defined as a type.
extern int pset_assign ( psetid_t pset, spu_t spu, psetid_t* opset)
^^^^^
Error 419: "/usr/include/sys/pset.h", line 188 # 'id_t' is used as a type, but
has not been defined as a type.
id_t id, psetid_t *opset);

정말 깨끗하고 멋진 프로그램을 짜고 싶습니다.

spacelee의 이미지

추가로 -D_XOPEN_SOURCE_EXTENDED or -D_HPUX_SOURCE
둘중에 하나를 더 넣어서 컴파일 해보세요.

C 언어 문법 기준도 여러가지가 있는데
(system call 등의 다른 사용에 따른)
그 버젼들을 지원하도록 하는 매크로인 것 같습니다.

역시 man pthread에 나온 내용이네요.^^;;

그리고 제일 중요한건 소스에서 에러가 안나도록
원인을 찾으시는게 먼저일꺼 같은데요..^^;;

권위를 의심할 것,어긋남을 존경할 것,자리잡기를 거부할 것,항상 자신을 재창조할 것 - MIT 미디어랩 -

댓글 달기

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