Hey n00b question.
I know there have been several posts about this, but none of the suggestions I find help.
Whenever I declare a slot in my .h file and define it in my .cpp file, it says that the ‘symbols not found for x86_64’. However when I comment out the slot declaration and definition, my program compiles fine. I really want to have these slots, so how can I declare/define them and have them work?
here is my code:
browser_v1.pro:
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += webkitwidgets
TARGET = browser_v1
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS +=
CONFIG += x86_64
mainwindow.h:
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QWebView>
#include <QLineEdit>
#include <QToolBar>
#include <QGridLayout>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(const QUrl& url);
void changeURLbarText();
private slots:
void changeURLbarText();
void makeSearchURL();
void makeSearch();
private:
Ui::MainWindow *ui;
QWebView *webview;
QLineEdit *URLbar;
QLineEdit *SearchBar;
QToolBar *NavBar;
QGridLayout *mainLayout;
};
#endif // MAINWINDOW_H
mainwindow.cpp:
#include "mainwindow.h"
MainWindow::MainWindow(const QUrl& Url)
{
webview = new QWebView(this);
webview->load(Url);
connect(webview, SIGNAL(loadFinished(bool)), SLOT(changeURLbarText()));
URLbar = new QLineEdit(this);
connect(URLbar, SIGNAL(returnPressed()), SLOT(makeSearchURL()));
SearchBar = new QLineEdit(this);
connect(SearchBar, SIGNAL(returnPressed()), SLOT(makeSearch()));
QToolBar *NavBar = addToolBar(tr("Navigation"));
NavBar->addAction(webview->pageAction(QWebPage::Back));
NavBar->addAction(webview->pageAction(QWebPage::Forward));
NavBar->addAction(webview->pageAction(QWebPage::Reload));
NavBar->addAction(webview->pageAction(QWebPage::Stop));
NavBar->addWidget(URLbar);
NavBar->addWidget(SearchBar);
setCentralWidget(webview);
setUnifiedTitleAndToolBarOnMac(true);
}
void MainWindow::changeURLbarText()
{
URLbar->setText(webview->Url().toString());
}
main.cpp:
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QUrl Url;
Url = QUrl("http://www.google.com/ncr");
//MainWindow w;
//w.show();
MainWindow *browser = new MainWindow(Url);
browser->show();
return a.exec();
}
if it matters, I am using a Macbook Pro OS X 10.9 (64 bit), Qt 5.2
thanks in advanced for your help!
↧