|
|
|
(Qt) Помогите найти ошибку.
|
|||
|---|---|---|---|
|
#18+
Этот код я целиком содрал с книги по Qt. Выполнил qmake. А при попытке make вылазят ошибки. Создаётся впечатление, что moc не выполняется. Вот finddialog.h: Код: plaintext 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. Код: plaintext 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. А вот ошибки: $ make g++ -c -pipe -Wall -W -pipe -Wall -O2 -march=i586 -mcpu=i686 -DGLX_GLXEXT_LEGACY -fno-exceptions -DQT_NO_DEBUG -I/usr/lib/qt3/mkspecs/default -I. -I. -I/usr/lib/qt3//include -o finddialog.o finddialog.cpp In file included from finddialog.cpp:7: finddialog.h:26:7: warning: no newline at end of file finddialog.cpp:9: error: syntax error before `::' token finddialog.cpp:11: error: ISO C++ forbids declaration of `label' with no type finddialog.cpp:11: error: `tr' was not declared in this scope finddialog.cpp:11: error: invalid use of `this' at top level finddialog.cpp:12: error: ISO C++ forbids declaration of `lineEdit' with no type finddialog.cpp:12: error: syntax error before `(' token finddialog.cpp:13: error: syntax error before `->' token finddialog.cpp:14: error: ISO C++ forbids declaration of `caseCheckBox' with no type finddialog.cpp:14: error: `tr' was not declared in this scope finddialog.cpp:14: error: invalid use of `this' at top level finddialog.cpp:15: error: ISO C++ forbids declaration of `backwardCheckBox' with no type finddialog.cpp:15: error: `tr' was not declared in this scope finddialog.cpp:15: error: invalid use of `this' at top level finddialog.cpp:16: error: ISO C++ forbids declaration of `findButton' with no type finddialog.cpp:16: error: `tr' was not declared in this scope finddialog.cpp:16: error: invalid use of `this' at top level finddialog.cpp:17: error: syntax error before `->' token finddialog.cpp:18: error: syntax error before `->' token finddialog.cpp:19: error: ISO C++ forbids declaration of `closeButton' with no type finddialog.cpp:19: error: `tr' was not declared in this scope finddialog.cpp:19: error: invalid use of `this' at top level finddialog.cpp:20: error: invalid use of `this' at top level finddialog.cpp:20: error: ISO C++ forbids declaration of `connect' with no type finddialog.cpp:20: error: initializer list being treated as compound expression finddialog.cpp:21: error: invalid use of `this' at top level finddialog.cpp:21: error: ISO C++ forbids declaration of `connect' with no type finddialog.cpp:21: error: redefinition of `int connect' finddialog.cpp:20: error: `int connect' previously defined here finddialog.cpp:21: error: initializer list being treated as compound expression finddialog.cpp:22: error: invalid use of `this' at top level finddialog.cpp:22: error: ISO C++ forbids declaration of `connect' with no type finddialog.cpp:22: error: redefinition of `int connect' finddialog.cpp:21: error: `int connect' previously defined here finddialog.cpp:22: error: initializer list being treated as compound expression finddialog.cpp:24: error: syntax error before `->' token finddialog.cpp:25: error: syntax error before `->' token finddialog.cpp:27: error: syntax error before `->' token finddialog.cpp:28: error: syntax error before `->' token finddialog.cpp:29: error: syntax error before `->' token finddialog.cpp:31: error: syntax error before `->' token finddialog.cpp:32: error: syntax error before `->' token finddialog.cpp:33: error: syntax error before `->' token finddialog.cpp:34: error: invalid use of `this' at top level finddialog.cpp:35: error: syntax error before `->' token finddialog.cpp:36: error: syntax error before `->' token finddialog.cpp:37: error: syntax error before `->' token finddialog.cpp:38: error: syntax error before `->' token finddialog.cpp:41: error: syntax error before `::' token finddialog.cpp:43: error: base operand of `->' is not a pointer finddialog.cpp:44: error: syntax error before `if' finddialog.cpp:50: error: syntax error before `::' token {standard input}: Assembler messages: {standard input}:49: Error: symbol `connect' is already defined {standard input}:55: Error: symbol `connect' is already defined make: *** [finddialog.o] Ошибка 1 ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 20.05.2005, 15:34 |
|
||
|
(Qt) Помогите найти ошибку.
|
|||
|---|---|---|---|
|
#18+
Не #ifdef ,а #ifndef ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 21.05.2005, 00:48 |
|
||
|
(Qt) Помогите найти ошибку.
|
|||
|---|---|---|---|
|
#18+
А в ответ make g++ -c -pipe -Wall -W -pipe -Wall -O2 -march=i586 -mcpu=i686 -DGLX_GLXEXT_LEGACY -fno-exceptions -DQT_NO_DEBUG -I/usr/lib/qt3/mkspecs/default -I. -I. -I/usr/lib/qt3//include -o finddialog.o finddialog.cpp In file included from finddialog.cpp:7: finddialog.h:26:7: warning: no newline at end of file finddialog.cpp: In constructor `FindDialog::FindDialog(QWidget*, const char*)': finddialog.cpp:9: error: no matching function for call to `QPushButton::QPushButton()' /usr/lib/qt3/include/qpushbutton.h:138: error: candidates are: QPushButton::QPushButton(const QPushButton&) /usr/lib/qt3/include/qpushbutton.h:67: error: QPushButton::QPushButton(const QIconSet&, const QString&, QWidget*, const char*) /usr/lib/qt3/include/qpushbutton.h:65: error: QPushButton::QPushButton(const QString&, QWidget*, const char*) /usr/lib/qt3/include/qpushbutton.h:64: error: QPushButton::QPushButton(QWidget*, const char*) finddialog.cpp:10: error: syntax error before `public' finddialog.cpp: At global scope: finddialog.cpp:10: error: virtual outside class declaration finddialog.cpp:10: error: non-member function `const char* className()' cannot have `const' method qualifier finddialog.cpp:10: error: virtual outside class declaration finddialog.cpp:10: error: virtual outside class declaration finddialog.cpp:10: error: virtual outside class declaration finddialog.cpp:10: error: virtual outside class declaration finddialog.cpp: In function `QObject* qObject()': finddialog.cpp:10: error: invalid use of `this' in non-member function finddialog.cpp: At global scope: finddialog.cpp:10: error: syntax error before `private' finddialog.cpp:11: error: ISO C++ forbids declaration of `setCaption' with no type finddialog.cpp:11: error: invalid conversion from `const char*' to `int' finddialog.cpp:12: error: ISO C++ forbids declaration of `label' with no type finddialog.cpp:12: error: invalid use of `this' at top level finddialog.cpp:13: error: ISO C++ forbids declaration of `lineEdit' with no type finddialog.cpp:13: error: syntax error before `(' token finddialog.cpp:14: error: syntax error before `->' token finddialog.cpp:15: error: ISO C++ forbids declaration of `caseCheckBox' with no type finddialog.cpp:15: error: invalid use of `this' at top level finddialog.cpp:16: error: ISO C++ forbids declaration of `backwardCheckBox' with no type finddialog.cpp:16: error: invalid use of `this' at top level finddialog.cpp:17: error: ISO C++ forbids declaration of `findButton' with no type finddialog.cpp:17: error: invalid use of `this' at top level finddialog.cpp:18: error: syntax error before `->' token finddialog.cpp:19: error: syntax error before `->' token finddialog.cpp:20: error: ISO C++ forbids declaration of `closeButton' with no type finddialog.cpp:20: error: invalid use of `this' at top level finddialog.cpp:21: error: invalid use of `this' at top level finddialog.cpp:21: error: ISO C++ forbids declaration of `connect' with no type finddialog.cpp:21: error: initializer list being treated as compound expression finddialog.cpp:22: error: invalid use of `this' at top level finddialog.cpp:22: error: ISO C++ forbids declaration of `connect' with no type finddialog.cpp:22: error: redefinition of `int connect' finddialog.cpp:21: error: `int connect' previously defined here finddialog.cpp:22: error: initializer list being treated as compound expression finddialog.cpp:23: error: invalid use of `this' at top level finddialog.cpp:23: error: ISO C++ forbids declaration of `connect' with no type finddialog.cpp:23: error: redefinition of `int connect' finddialog.cpp:22: error: `int connect' previously defined here finddialog.cpp:23: error: initializer list being treated as compound expression finddialog.cpp:25: error: syntax error before `->' token finddialog.cpp:26: error: syntax error before `->' token finddialog.cpp:28: error: syntax error before `->' token finddialog.cpp:29: error: syntax error before `->' token finddialog.cpp:30: error: syntax error before `->' token finddialog.cpp:32: error: syntax error before `->' token finddialog.cpp:33: error: syntax error before `->' token finddialog.cpp:34: error: syntax error before `->' token finddialog.cpp:35: error: invalid use of `this' at top level finddialog.cpp:36: error: syntax error before `->' token finddialog.cpp:37: error: syntax error before `->' token finddialog.cpp:38: error: syntax error before `->' token finddialog.cpp:39: error: syntax error before `->' token finddialog.cpp:42: error: no `void FindDialog::findClicked()' member function declared in class `FindDialog' finddialog.cpp:10: warning: `bool qt_static_property(QObject*, int, int, QVariant*)' declared `static' but never defined finddialog.cpp:10: warning: `QMetaObject* staticMetaObject()' declared `static' but never defined finddialog.cpp:10: warning: `QString tr(const char*, const char*)' declared `static' but never defined finddialog.cpp:10: warning: `QString trUtf8(const char*, const char*)' declared `static' but never defined {standard input}: Assembler messages: {standard input}:55: Error: symbol `connect' is already defined {standard input}:61: Error: symbol `connect' is already defined make: *** [finddialog.o] Ошибка 1 ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 21.05.2005, 07:58 |
|
||
|
(Qt) Помогите найти ошибку.
|
|||
|---|---|---|---|
|
#18+
Особенно порадовала finddialog.cpp:10: error: syntax error before `public' Где там public? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 21.05.2005, 08:00 |
|
||
|
(Qt) Помогите найти ошибку.
|
|||
|---|---|---|---|
|
#18+
1) Вместо QPushButton *findButton, closeButton ; Очевидно должно быть QPushButton *findButton, *closeButton ; ===что следует с одной стороны из сообщений : finddialog.cpp:9: error: no matching function for call to `QPushButton::QPushButton()' /usr/lib/qt3/include/qpushbutton.h:138: error: candidates are: QPushButton::QPushButton(const QPushButton&) /usr/lib/qt3/include/qpushbutton.h:67: error: QPushButton::QPushButton(const QIconSet&, const QString&, QWidget*, const char*) /usr/lib/qt3/include/qpushbutton.h:65: error: QPushButton::QPushButton(const QString&, QWidget*, const char*) /usr/lib/qt3/include/qpushbutton.h:64: error: QPushButton::QPushButton(QWidget*, const char*) (т.е. конструктор FindDialog не может проинициализировать член closeButton не имея для него ( closeButton ) конструктора без параметров) ===и из кода с другой closeButton = new QPushButton(tr("Close"), this); 2)По поводу public В файле finddialog.cpp есть директива #include "finddialog.h" препроцессора ( прекомпилятора ) Поэтому к компилятору файл finddialog.cpp попадает с уже "вставленным во внуть" finddialog.h в котором есть public. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 21.05.2005, 12:27 |
|
||
|
(Qt) Помогите найти ошибку.
|
|||
|---|---|---|---|
|
#18+
Исправил. Ошибки другими стали. Всё постить не буду. Вот давай с этим разберёмся: finddialog.cpp: In constructor `FindDialog::FindDialog(QWidget*, const char*)': finddialog.cpp:10: error: syntax error before `public' finddialog.cpp: At global scope: finddialog.cpp:10: error: virtual outside class declaration finddialog.cpp:10: error: non-member function `const char* className()' cannot have `const' method qualifier finddialog.cpp:10: error: virtual outside class declaration finddialog.cpp:10: error: virtual outside class declaration finddialog.cpp:10: error: virtual outside class declaration finddialog.cpp:10: error: virtual outside class declaration ЗЫ: извини, что отвлекаю. Просто я в С++ новичёк. Мне помощь нужна. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 22.05.2005, 00:02 |
|
||
|
(Qt) Помогите найти ошибку.
|
|||
|---|---|---|---|
|
#18+
Еще есть lineEdit = new QlineEdit(this); должно быть lineEdit = new QLineEdit(this); в finddialog.h void findCliced(); должно быть void findClicked(); ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 24.05.2005, 21:14 |
|
||
|
(Qt) Помогите найти ошибку.
|
|||
|---|---|---|---|
|
#18+
Обрати внимание finddialog.h:26:7: warning: no newline at end of file исправь сначало это. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 27.05.2005, 08:31 |
|
||
|
(Qt) Помогите найти ошибку.
|
|||
|---|---|---|---|
|
#18+
Void666Обрати внимание finddialog.h:26:7: warning: no newline at end of file исправь сначало это. маловероятно, что это может влиять на что-либо ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 27.05.2005, 08:52 |
|
||
|
(Qt) Помогите найти ошибку.
|
|||
|---|---|---|---|
|
#18+
Землекоп Void666Обрати внимание finddialog.h:26:7: warning: no newline at end of file исправь сначало это. маловероятно, что это может влиять на что-либо Ну почему же, смотрим лог, сначала идет finddialog.h:26:7: warning: no newline at end of file затем finddialog.cpp:9: error: syntax error before `::' token Явно, компилятор врет, т.к. с синтаксисом там все окей, следовательно был не корректно обработан хидер файл, рыть нужно варнинг. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 27.05.2005, 09:06 |
|
||
|
(Qt) Помогите найти ошибку.
|
|||
|---|---|---|---|
|
#18+
Void666 Землекоп Void666Обрати внимание finddialog.h:26:7: warning: no newline at end of file исправь сначало это. маловероятно, что это может влиять на что-либо Ну почему же, смотрим лог, сначала идет finddialog.h:26:7: warning: no newline at end of file затем finddialog.cpp:9: error: syntax error before `::' token Явно, компилятор врет, т.к. с синтаксисом там все окей, следовательно был не корректно обработан хидер файл, рыть нужно варнинг. После исправлений, которые я дал чуть выше, все нормально компилиться. Там много наведенных ошибок. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 27.05.2005, 09:17 |
|
||
|
(Qt) Помогите найти ошибку.
|
|||
|---|---|---|---|
|
#18+
Ошибки продолжаются. Землекоп, а ты можешь кинуть сюда сои файлы, если ты их собирал. Попробую пересобрать. Вот ошибки: [sarin@localhost findDialog]$ make g++ -c -pipe -Wall -W -pipe -Wall -O2 -march=i586 -mcpu=i686 -DGLX_GLXEXT_LEGACY -fno-exceptions -DQT_NO_DEBUG -I/usr/lib/qt3/mkspecs/default -I. -I. -I/usr/lib/qt3//include -o finddialog.o finddialog.cpp finddialog.cpp: In constructor `FindDialog::FindDialog(QWidget*, const char*)': finddialog.cpp:10: error: syntax error before `public' finddialog.cpp: At global scope: finddialog.cpp:10: error: virtual outside class declaration finddialog.cpp:10: error: non-member function `const char* className()' cannot have `const' method qualifier finddialog.cpp:10: error: virtual outside class declaration finddialog.cpp:10: error: virtual outside class declaration finddialog.cpp:10: error: virtual outside class declaration finddialog.cpp:10: error: virtual outside class declaration finddialog.cpp: In function `QObject* qObject()': finddialog.cpp:10: error: invalid use of `this' in non-member function finddialog.cpp: At global scope: finddialog.cpp:10: error: syntax error before `private' finddialog.cpp:11: error: ISO C++ forbids declaration of `setCaption' with no type finddialog.cpp:11: error: invalid conversion from `const char*' to `int' finddialog.cpp:12: error: ISO C++ forbids declaration of `label' with no type finddialog.cpp:12: error: invalid use of `this' at top level finddialog.cpp:13: error: ISO C++ forbids declaration of `lineEdit' with no type finddialog.cpp:13: error: invalid use of `this' at top level finddialog.cpp:14: error: syntax error before `->' token finddialog.cpp:15: error: ISO C++ forbids declaration of `caseCheckBox' with no type finddialog.cpp:15: error: invalid use of `this' at top level finddialog.cpp:16: error: ISO C++ forbids declaration of `backwardCheckBox' with no type finddialog.cpp:16: error: invalid use of `this' at top level finddialog.cpp:17: error: ISO C++ forbids declaration of `findButton' with no type finddialog.cpp:17: error: invalid use of `this' at top level finddialog.cpp:18: error: syntax error before `->' token finddialog.cpp:19: error: syntax error before `->' token finddialog.cpp:20: error: ISO C++ forbids declaration of `closeButton' with no type finddialog.cpp:20: error: invalid use of `this' at top level finddialog.cpp:21: error: invalid use of `this' at top level finddialog.cpp:21: error: ISO C++ forbids declaration of `connect' with no type finddialog.cpp:21: error: initializer list being treated as compound expression finddialog.cpp:22: error: invalid use of `this' at top level finddialog.cpp:22: error: ISO C++ forbids declaration of `connect' with no type finddialog.cpp:22: error: redefinition of `int connect' finddialog.cpp:21: error: `int connect' previously defined here finddialog.cpp:22: error: initializer list being treated as compound expression finddialog.cpp:23: error: invalid use of `this' at top level finddialog.cpp:23: error: ISO C++ forbids declaration of `connect' with no type finddialog.cpp:23: error: redefinition of `int connect' finddialog.cpp:22: error: `int connect' previously defined here finddialog.cpp:23: error: initializer list being treated as compound expression finddialog.cpp:25: error: syntax error before `->' token finddialog.cpp:26: error: syntax error before `->' token finddialog.cpp:28: error: syntax error before `->' token finddialog.cpp:29: error: syntax error before `->' token finddialog.cpp:30: error: syntax error before `->' token finddialog.cpp:32: error: syntax error before `->' token finddialog.cpp:33: error: syntax error before `->' token finddialog.cpp:34: error: syntax error before `->' token finddialog.cpp:35: error: invalid use of `this' at top level finddialog.cpp:36: error: syntax error before `->' token finddialog.cpp:37: error: syntax error before `->' token finddialog.cpp:38: error: syntax error before `->' token finddialog.cpp:39: error: syntax error before `->' token finddialog.cpp:10: warning: `bool qt_static_property(QObject*, int, int, QVariant*)' declared `static' but never defined finddialog.cpp:10: warning: `QMetaObject* staticMetaObject()' declared `static' but never defined finddialog.cpp:10: warning: `QString tr(const char*, const char*)' declared `static' but never defined finddialog.cpp:10: warning: `QString trUtf8(const char*, const char*)' declared `static' but never defined {standard input}: Assembler messages: {standard input}:55: Error: symbol `connect' is already defined {standard input}:61: Error: symbol `connect' is already defined make: *** [finddialog.o] Ошибка 1 ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 27.05.2005, 13:24 |
|
||
|
(Qt) Помогите найти ошибку.
|
|||
|---|---|---|---|
|
#18+
Я собирал под MS VC++ 6.0, но особой разницы быть не должно. finddialog.h Код: plaintext 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. finddialog.cpp Код: plaintext 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 27.05.2005, 14:07 |
|
||
|
(Qt) Помогите найти ошибку.
|
|||
|---|---|---|---|
|
#18+
finddialog.h Код: plaintext 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. finddialog.cpp Код: plaintext 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. А вот этого файла у тебя нет: main.cpp Код: plaintext 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. А это скриншот того что должно получится ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 27.05.2005, 14:25 |
|
||
|
(Qt) Помогите найти ошибку.
|
|||
|---|---|---|---|
|
#18+
Под Windows ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 27.05.2005, 14:48 |
|
||
|
(Qt) Помогите найти ошибку.
|
|||
|---|---|---|---|
|
#18+
Последнее собралось. Значит дело в моих кривых руках. Но вот проблема: в каталоге где я собирал бинарника не получилось. А получился пустой документ в 0 байт, при клике на котором запускается прога. Где бинарник? Поиск не помог. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 27.05.2005, 14:56 |
|
||
|
|

start [/forum/topic.php?fid=57&msg=33087415&tid=2033240]: |
0ms |
get settings: |
8ms |
get forum list: |
15ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
46ms |
get topic data: |
12ms |
get forum data: |
3ms |
get page messages: |
59ms |
get tp. blocked users: |
2ms |
| others: | 246ms |
| total: | 399ms |

| 0 / 0 |
