리눅스 c++컴파일 라이브러리추가.

wogns041의 이미지

안녕하세요.
리눅스에서 이클립스를 이용해 OpenGL을 사용해보려 합니다.

일반적으로 vi컴파일시에는 gcc -o abc abc.c -lGL
이런식으로 라이브러리 추가가 가능 한데요.
이클립스에선 어덯게 해야 하는지 모르겠습니다.
답변 부탁 드려요.

추가 질문으로. 페도라9 부팅시 2개의 커널 버전이 나오는데요.
상위 버전으로 접속시 X윈도가 나오질 않네요..
var/log 의 xorg로그를 보면.. 그게 언제 만들어 진지는 모르겠는데 no screen으로 나오네요..
하위 버전으로 접속 하면 접속 되구요.

그럼 답변 부탁 드리겠습니다.

wogns041의 이미지

프로젝트 Properties 에 들어 가셔서
c/c++ Build의 Settings에 들어 가시면
GCC C++ Linker라고 있습니다.
여기에 보시면 Libraries라고 있는데
여기에 하나씩 추가 하시면 됩니다.
추가 버튼 누르고 모든 옵션을 주는 것이 아니고
-l은 기본적으로 있기 때문에
-lGL -lGLU라는 옵션을 주고 싶을 경우
GL 을 추가 하고 다시 한번 GLU를 추가 하시면 됩니다.

잘 되네요.

dokeun의 이미지

원래 코드블럭에서 포트란을 쓰다가 이번에 이클립스에서 C를 써보는 중입니다.

헤더파일 /opt/cgns/include/cgnslib.h과
라이브러리 /opt/cgns/lib/libcgns.a를 사용하려고 하는데요.

Project>Properties>C/C++Build>Settings에서

GCC C Compiler>Includes의 -I에 '/opt/cgns/include'를 추가하고
GCC C Linker>Libraries의 -l에 'libcgns.a'를, -L에 '/opt/cgns/lib'를 각각 추가한 결과는 아래와 같습니다.

make all
Building target: write_grid_unst
Invoking: GCC C Linker
gcc -L/opt/cgns/lib -o "write_grid_unst" ./write_grid_unst.o -llibcgns.a
/usr/bin/ld: cannot find -llibcgns.a
collect2: error: ld returned 1 exit status
make: *** [write_grid_unst] Error 1

분명히 /opt/cgsn/lib에 libcgns.a가 있는데 왜 못찾는 걸까요?

klara의 이미지

-l 옵션은 -l라이브러리명 이렇게 씁니다. 라이브러리명은 lib라이브러리명.확장자에서 lib때고 확장자땐 부분이 라이브러리명이 됩니다. 이경우에는 -llibcgns.a가 아니라 -lcgns 가 맞는 옵션입니다.

dokeun의 이미지

덕분에 깔끔하게 해결 됐습니다.

gcc 설명서를 더 잘 봤어야 했는데, 펴놓고도 못 봤네요.

댓글 달기

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