QT 처음사용해보는 초보입니다 이게 왜이런건지...

green8146의 이미지

아예 다 에러가 나네요

hello.cpp:1:26: error: qapplication.h: 그런 파일이나 디렉토리가 없음
hello.cpp:3:20: error: qlabel.h: 그런 파일이나 디렉토리가 없음
hello.cpp: In function ‘int main(int, char**)’:
hello.cpp:11: error: ‘QApplication’ was not declared in this scope
hello.cpp:11: error: expected `;' before ‘app’
hello.cpp:13: error: ‘QLabel’ was not declared in this scope
hello.cpp:13: error: ‘hello’ was not declared in this scope
hello.cpp:13: error: expected type-specifier before ‘QLabel’
hello.cpp:13: error: expected `;' before ‘QLabel’
hello.cpp:17: error: ‘app’ was not declared in this scope
[root@jsydev NewPVViewer]# gcc -c hello.cpp -l$QTDIR/include
hello.cpp:1:26: error: qapplication.h: 그런 파일이나 디렉토리가 없음
hello.cpp:3:20: error: qlabel.h: 그런 파일이나 디렉토리가 없음
hello.cpp: In function ‘int main(int, char**)’:
hello.cpp:11: error: ‘QApplication’ was not declared in this scope
hello.cpp:11: error: expected `;' before ‘app’
hello.cpp:13: error: ‘QLabel’ was not declared in this scope
hello.cpp:13: error: ‘hello’ was not declared in this scope
hello.cpp:13: error: expected type-specifier before ‘QLabel’
hello.cpp:13: error: expected `;' before ‘QLabel’
hello.cpp:17: error: ‘app’ was not declared in this scope

지금 인턴으로 뷰어(이미 만들어져있는걸 소스만 조금 바꿔서 업데이트하는작업) 을 개발 하고 있는데 줄마다 에러가 떠서 걍 기초적인 걸 시험삼아 컴파일 시켜봤는데 이것도 마찬가지이네요

os는 페도라 리눅스 7.0이고요 큐티 버전은 QT4 4.3.2.
이네여 참고삼으시라고 제가 한 기초적인 소스도 올려봅니다.

#include

#include

int main( int argc, char **argv )

{

QApplication app( argc, argv );

QLabel *hello = new QLabel( "Hello Qt!"

"", 0 );

app.setMainWidget( hello );

hello->show();

return app.exec();

}
~

givepray1111의 이미지

qmake를 이용하여 Makefile 만든 다음 make하세요.

klara의 이미지

적으신 코드는 Qt3용 코드이고, Qt4에서는 Qt3용 코드는 별도의 옵션없이는 컴파일이 안됩니다.
Qt4를 이용하실거라면 Qt4를 공부하세요.

valentis의 이미지

환경 설정이 잘못되어 있는 것 같습니다.
앞에서 말씀하신데로 소스코드는 Qt3로 되어있고 헤더파일과 라이브러리는 Qt4를 참고할려고 하네요.
QTDIR 환경변수가 어디를 가르키는지 확인해보시는 것이 좋을 것 같습니다.

-------------------------------------

서영진 입니다.
Homepage : http://valentis.pe.kr
blog : http://www.lifeholic.com

-------------------------------------

서영진 입니다.
Homepage : http://valentis.pe.kr
blog : http://www.lifeholic.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
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.