I have started a Qt Project with Qt Creator and I want to use some mathematical functions. I have included math.h. But when I want to use a function, I got an error that the function is not declared in this scope. I also tried mathc, but then I got over 20 errors in cmath. I tried a fresh Ubuntu 12 installation and newest versin of Qt Creator and also Windows 7. Both sytems produce the same error. What I am doing wrong?
#include <QtGui/QApplication>
#include "mainwindow.h"
#include <QDesktopWidget>
#include <QStyle>
#include <math.h>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.setGeometry(
QStyle::alignedRect(
Qt::LeftToRight,
Qt::AlignCenter,
w.size(),
qApp->desktop()->availableGeometry()
));
w.show();
int i= pow(2,2);
return a.exec();
}