Objective C++ and Qt
-
Hi,
I would like to mix up objective C++ and Qt to work bluetooth in my mac desktop project. here is what I did for testing and it's not working. It's 'no sense code', but I would like to run it without errors:
QT += core gui
TARGET = untitled
TEMPLATE = appSOURCES += main.cpp
mac {
OBJECTIVE_HEADERS += mainwindow.hOBJECTIVE_SOURCES += mainwindow.mm
}
#ifndef MAINWINDOW_H
#define MAINWINDOW_Hclass MainWindow{
public:
MainWindow();
~MainWindow();
};#endif // MAINWINDOW_H
#include "mainwindow.h"
#include <Foundation/Foundation.h>MainWindow::MainWindow()
{
NSString *s= @"string"; //if I take this line in a comment of corse it's working
}MainWindow::~MainWindow()
{}
@
Why it doesn't work?
-
really helpful, thank you Volker
-
If you're using Qt Creator, then unfortunately the error pane doesn't show that useful error messages. It's just a "symbol(s) not found" and "collect2: ld returned exit status 1". You should go to the compilation pane then, the error messages there are more elaborate.
In your special case here, if you use a Mac framework, you will have to add it to the LIBS variable. Some of them are added by Qt by default, some need manual addition.