Error while executing Qt console application program on Mac os X - qt

I am trying to run a simple console application (Hello World program) on Qt 5.6.0. Here is the code:
#include <QCoreApplication>
#include <QDebug>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
qDebug() << "Hello World";
return a.exec();
}
But it's generating error. ([main.o]error 2).
11:37:44: Running steps for project test... 11:37:44: Configuration
unchanged, skipping qmake step. 11:37:44: Starting: "/usr/bin/make"
/Applications/Xcode
7.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-c -pipe -stdlib=libc++ -g -std=gnu++11 -isysroot /Applications/Xcode 7.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk
-mFile Doesn't Exist, Will Create: /Applications/Xcode Invalid Arguments -version-min=10.7 -Wall -W -fPIC -DQT_QML_DEBUG
-DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../test -I. -I../Qt5.6.0/5.6/clang_64/lib/QtWidgets.framework/Headers -I../Qt5.6.0/5.6/clang_64/lib/QtGui.framework/Headers -I../Qt5.6.0/5.6/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode -I7.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/OpenGL.framework/Headers
-I/Applications/Xcode -I7.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AGL.framework/Headers/
-I. -I../Qt5.6.0/5.6/clang_64/mkspecs/macx-clang -F/Users/macwaves/Qt5.6.0/5.6/clang_64/lib -o main.o ../test/main.cpp /bin/sh: -c: line 0: unexpected EOF while looking for matching `''
/bin/sh: -c: line 1: syntax error: unexpected end of file make: ***
[main.o] Error 2 11:37:44: The process "/usr/bin/make" exited with
code 2. Error while building/deploying project test (kit: Desktop Qt
5.6.0 clang 64bit) When executing step "Make" 11:37:44: Elapsed time: 00:00.
I tried to set PATH (/Users/macwaves/Qt5.6.0/5.6/clang_64/bin). Renamed my Xcode 7.app to Xcode7.app but, problem still persists.
Can anybody help?
Here is a snapshot of my problem :

I have just uninstall(5.6.0) and reinstalled the older version (5.5.1) on my mac os x. It works smoothly. :)

Related

QtCreator: Header files not found when using CMake

I have tried this on multiple platforms, experiencing the same issue every time.
I successfully build and run my C++ OpenFrameworks application using QtCreator - no problems are encountered.
Then, I successfully use qmake to generate the project file.
Yet when I attempt to make the executable, I receive the following error:
make
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -O2 -std=gnu++1z -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -mmacosx-version-min=12 -Wall -Wextra -fPIC -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I. -I. -I/opt/homebrew/lib/QtGui.framework/Headers -I/opt/homebrew/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/AGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/AGL.framework/Headers -I/opt/homebrew/share/qt/mkspecs/macx-clang -F/opt/homebrew/lib -o main.o src/main.cpp
src/main.cpp:1:10: fatal error: 'ofMain.h' file not found
#include "ofMain.h"
^~~~~~~~~~
1 error generated.
make: *** [main.o] Error 1
I can go into the .pro file and add things to the include path manually, but I don't see why these includes aren't generated automatically?
I think I recognized your problem.
The file name is main.cpp in the src/ folder. Based on its location in the src/ folder, I think your ofMain.h file is also in the src/ folder. Now a question: did you add src/ to your include path? If not with the following line:
INCLUDEPATH += \
src/
It should work now I hope.
Have a nice day!

qt compile error including QtCore resulting in utf-8 error

Getting the following error in my library when trying to compile a library that is linking against Qt.
/opt/local/libexec/qt5/lib/QtCore.framework/QtCore:1:1: error: source file is not valid UTF-8
File.cxx is
#include <QtCore>
int main(){
return 0;
}
Using mac ports
Unsure if this is some weird mac problem or?
/opt/local/bin/clang++-mp-11 -DQT_CORE_LIB -D_LINUX_OS_ -D_XOPEN_SOURCE=600 -I/opt/local/libexec/qt5/include -isystem /opt/local/libexec/qt5/lib/QtCore.framework -isystem /opt/local/libexec/qt5/lib/QtCore.framework/Headers -isystem /opt/local/libexec/qt5/./mkspecs/macx-clang -g -std=c99 -pedantic -Wall -Wstrict-prototypes -Wwrite-strings -Wpointer-arith -Wcast-align -Werror -fPIC -std=gnu++11 -MD -MT fie.cxx.obj -MF file.cxx.obj.d -o file.cxx.obj -c file.cxx
Ive gotten similar results using xcode's compiler
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/CC

Openssh 8.0p1 compile error indicating missing 'fd_set' in kludge-fd_set.c

OpenSSH is configured to used openssl 3.0.0 and no error was found on configuration. On compile, an error indicating an unknown type name 'fd_set' was raised for the file kludge-fd_set.c:19:27
This is for an AIX 7.1 server that is being customized to run Hadoop. Most of the built-in features have recently been updated and as I rarely do infrastructure software development in C I am not sure which package I should look for/upgrade to get that type.
(cd openbsd-compat && make)
gcc -g -O2 -pipe -Wall -Wpointer-arith -Wuninitialized -Wsign-compare -Wformat-security -Wsizeof-pointer-memaccess -Wno-pointer-sign -Wno-unused-result -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -ftrapv -fno-builtin-memset -I. -I.. -I. -I./.. -I/usr/local/include -DHAVE_CONFIG_H -c kludge-fd_set.c
kludge-fd_set.c:19:27: error: unknown type name 'fd_set'
19 | void kludge_FD_SET(int n, fd_set *set) {
| ^~~~~~
kludge-fd_set.c:22:28: error: unknown type name 'fd_set'
22 | int kludge_FD_ISSET(int n, fd_set *set) {
| ^~~~~~
make: 1254-004 The error code from the last command is 1.
Stop.
make: 1254-004 The error code from the last command is 2.
Stop.
I'm using GCC 9.1 and the installation/compile guide have indicated that this should be an open-and-shut procedure.
The comment from Lorinczy Zsigmond was the fix I used to resolve it.

Cute Report Test Fail

I'm testing a Cute report writer, working with QT. My problem is that when i add the include directory to the .pro file i get the following error:
11:50:41: Running steps for project ReportTest...
11:50:41: Starting: "C:\Qt\5.9.1\mingw53_32\bin\qmake.exe" C:\Users\dkolb\Documents\Develop\test\ReportTest\ReportTest.pro -spec win32-g++
Info: creating stash file C:\Users\dkolb\Documents\Develop\test\build-ReportTest-Desktop_Qt_5_9_1_MinGW_32bit-Release\.qmake.stash
11:50:44: The process "C:\Qt\5.9.1\mingw53_32\bin\qmake.exe" exited normally.
11:50:44: Starting: "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" qmake_all
mingw32-make: Nothing to be done for 'qmake_all'.
11:50:48: The process "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" exited normally.
11:50:48: Starting: "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe"
C:/Qt/Tools/mingw530_32/bin/mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory 'C:/Users/dkolb/Documents/Develop/test/build-ReportTest-Desktop_Qt_5_9_1_MinGW_32bit-Release'
'C:\Qt\5.9.1\mingw53_32\bin\uic.exe' ../ReportTest/mainwindow.ui -o ui_mainwindow.h
g++ -c -fno-keep-inline-dllexport -pipe -O2 -std=gnu++11 -Wextra -Wall -W -fexceptions -mthreads -DUNICODE -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../ReportTest -I. -I"C:/Program Files (x86)/ExaroLogic/CuteReport/development/include/cutereport" -IC:/Qt/5.9.1/mingw53_32/include -IC:/Qt/5.9.1/mingw53_32/include/QtWidgets -IC:/Qt/5.9.1/mingw53_32/include/QtGui -IC:/Qt/5.9.1/mingw53_32/include/QtANGLE -IC:/Qt/5.9.1/mingw53_32/include/QtCore -Irelease -I. -IC:/Qt/5.9.1/mingw53_32/mkspecs/win32-g++ -o release/main.o ../ReportTest/main.cpp
Makefile.Release:346: recipe for target 'release/main.o' failed
mingw32-make[1]: Leaving directory 'C:/Users/dkolb/Documents/Develop/test/build-ReportTest-Desktop_Qt_5_9_1_MinGW_32bit-Release'
Makefile:36: recipe for target 'release' failed
mingw32-make[1]: *** [release/main.o] Error -1073741502
mingw32-make: *** [release] Error 2
11:50:58: The process "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project ReportTest (kit: Desktop Qt 5.9.1 MinGW 32bit)
When executing step "Make"
11:50:58: Elapsed time: 00:17.
For testing I'm using an empty gui application.It does compile when i take the include out.
I have download the 32bit version of the report writer as i'm compiling on 32bits, but i don't think that QT is even near the dlls. Here is the .pro file:
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = ReportTest
TEMPLATE = app
INCLUDEPATH += "C:/Program Files (x86)/ExaroLogic/CuteReport/development/include/cutereport"
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
mainwindow.cpp
HEADERS += \
mainwindow.h
FORMS += \
mainwindow.ui

Undefined symbols for architecture x86_64 Using QT with Opencv

I am using QT's IDE with OpenCV. The code works fine in Xcode but when I copy them to QT for GUI design, it doesn't work at all. I searched like crazy...
Here is the error message:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -g -gdwarf-2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -mmacosx-version-min=10.9 -Wall -W -fPIE -DQT_CORE_LIB -I../../../../Qt/5.2.1/clang_64/mkspecs/macx-clang -I../Hello -I/usr/local/include -I../../../../Qt/5.2.1/clang_64/lib/QtCore.framework/Versions/5/Headers -I. -I. -F/Users/Chenxi/Qt/5.2.1/clang_64/lib -o main.o ../Hello/main.cpp
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -headerpad_max_install_names -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -mmacosx-version-min=10.9 -o Hello main.o -F/Users/Chenxi/Qt/5.2.1/clang_64/lib -L/usr/local/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_objdetect -lopencv_calib3d -framework QtCore
Undefined symbols for architecture x86_64:
"cv::imread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int)", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Hello] Error 1
main.cpp:
So it should be the link error with opencv I think.
#include <QCoreApplication>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv/cv.h>
#include <iostream>
using namespace std;
using namespace cv;
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
cout<<"hello world"<<endl;
Mat test(10,10,CV_8UC1);
cout<<test.cols<<endl;
Mat test1 = imread("/Users/master/desktop/FYP/GUI/Demo_db/neg_1.png");
return a.exec();
}
.pro file:
QT += core
QT -= gui
TARGET = Hello
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
INCLUDEPATH += /usr/local/include
LIBS += -L/usr/local/lib \
-lopencv_core \
-lopencv_imgproc \
-lopencv_highgui \
-lopencv_objdetect \
-lopencv_calib3d
SOURCES += main.cpp
I have tried this answer but it doesn't work for me:
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6 to 10.9
Could anyone help me? Thanks.
I think you will need to change from the default gnu C++ std implementation to the following by passing it to your compiler, which is presumably clang:
-stdlib=libc++
In short, do not mix gcc and clang if you do that because unfortunately they are not 100% abi compatible, sadly. You could check which one the libopencv was built with:
otool -L libopencv-version.dylib

Resources