Undefined reference to log10

I am building using Eclipse Kepler, and have included math.h . However, I am getting an error

Also types uint8_t and unit32_t are not being resolved. I have included both stdint.h and inttypes.h , just to be sure, but wasn’t successful. Can someone kindly help?

1 Answer 1

Because, the header file only provides the forward declaration of the function. The actual function definition is present in the ("math") library. You need to link with the math library using -lm .

Reference: man page for log10

Also, AFAIK, uint _t are present in . Please check for the existence for the header file itself and/or any typos (like unit32_t in your example) in your code.

Not the answer you’re looking for? Browse other questions tagged c undefined-reference or ask your own question.

Linked

Related

Hot Network Questions

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

site design / logo © 2020 Stack Exchange Inc; user contributions licensed under cc by-sa 4.0 with attribution required. rev 2020.1.17.35809

I am building using Eclipse Kepler, and have included math.h . However, I am getting an error

Also types uint8_t and unit32_t are not being resolved. I have included both stdint.h and inttypes.h , just to be sure, but wasn’t successful. Can someone kindly help?

1 Answer 1

Because, the header file only provides the forward declaration of the function. The actual function definition is present in the ("math") library. You need to link with the math library using -lm .

Reference: man page for log10

Also, AFAIK, uint _t are present in . Please check for the existence for the header file itself and/or any typos (like unit32_t in your example) in your code.

Читайте также:  37369 Код какой страны

Имеется Qt_5_3_MinGW_32bit, Windiws 7 64bit.
Работаю в графическом приложении QT.
В хэдере (mainwindow.h) обявлено следующее:

Далее при нажатии на кнопку вызываю метод void separateImage(char* path_to_image);
mainwindow.cpp :
На кнопке написано следующее:

Возникающие ошибки:
D:QtProjectsLabArcheo_PartCeramicResiduesAsMosaicmainwindow.cpp:104: ошибка: undefined reference to `MainWindow::separateImage(char*)’
и
collect2.exe:-1: ошибка: error: ld returned 1 exit status

Данная ошибка возникает, если вместо char передавать QString, соответственно, изменив функцию separate_image.

Часть кода separate_image выглядит следующим образом:

  • Вопрос задан более трёх лет назад
  • 36297 просмотров

Часть кода separate_image выглядит следующим образом:

Так как separateImage() вы объявили как приватный метод класса MainWindow.
Внимательно читаем документацию на Qt и учебник по языку C++.

Rate this post

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *