I have installed the MinGW compiler and I am attempting to run a C++ QT Application from within Netbeans.
As you can see from this screenshot, I have successfully set up the native build tools using Netbeans:
Unfortunately when attempting to run my program, I get the following error:
make.exe": /bin/sh: Command not found
make.exe": /bin/sh: Command not found
make.exe": *** [.validate-impl] Error 127
BUILD FAILED (exit value 2, total time: 303ms)
Just to be clear, I am not running a complicated program, in fact, I am just trying to execute a basic generated main file:
#include <QApplication>
int main(int argc, char *argv[]) {
// initialize resources, if needed
// Q_INIT_RESOURCE(resfile);
QApplication app(argc, argv);
// create and show your widgets here
return app.exec();
}
You can download my Makefile-Debug and Makefile-impl here: http://wikisend.com/download/467700/makefiles.zip
I would be extremely grateful for your help.
Related
windows 10 install:
vs2019
Win64OpenSSL-3_0_5
qca-2.3.4
qt-5.15.2
using cmake build and install to qt directory
then I test the library.
bool temp = QCA::isSupported("cert", QStringLiteral("qca-ossl"));
the program exit here,and report “Failed to load Legacy provider”
note,this code used by qgis.
the program load dll correctly!
QCA::Initializer init;
QCoreApplication app(argc, argv);
QCA::scanForPlugins();
bool temp4s = QCA::isSupported("sha224", QStringLiteral("qca-ossl"));
I have problems loading the built-in plugins for iconengines for a deployed application. Below is a minimal program to show the problem. It is not exactly the same, because Qt scans the plugin directories at start and registers it according to the file suffix, but I hope when I can get the minimal program to run, then the automatic scanning works, too.
main.cpp:
#include <QCoreApplication>
#include <QPluginLoader>
#include <QDebug>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QPluginLoader loader("C:/Qt/5.15.1/msvc2019_64/plugins/iconengines/qsvgicon.dll");
if (loader.load()) {
qDebug() << "load ok";
} else {
qDebug() << "load failed";
}
return a.exec();
}
and PluginTest.pro:
QT -= gui
CONFIG += c++11 console
CONFIG -= app_bundle
SOURCES += main.cpp
When I start it from the Qt Creator IDE, version 4.13.1, with Visual Studio 2019, 64 bit compiled, it prints "load ok". Now I do this from a "x64 Native Tools Command Prompt for VS 2019" command prompt in the project directory:
set PATH=%PATH%;C:\Qt\5.15.1\msvc2019_64\bin
mkdir deploy
copy release\PluginTest.exe deploy
windeployqt --release release\PluginTest.exe --plugindir deploy\QtPlugins
When I start PluginText.exe from the command prompt in the deploy directory, I get the output "load failed".
Additional information: when I set set qt_debug_plugins=1 and start the real application, I see these errors:
QFactoryLoader::QFactoryLoader() checking directory path "C:/projects/deploy/QtPlugins/iconengines" ...
QFactoryLoader::QFactoryLoader() looking at "C:/projects/deploy/QtPlugins/iconengines/qsvgicon.dll"
"Failed to extract plugin meta data from 'C:/projects/deploy/QtPlugins/iconengines/qsvgicon.dll'"
not a plugin
The qsvgicon.dll file is identical to "c:\Qt\5.15.1\msvc2019_64\plugins\iconengines\qsvgicon.dll".
I found the problem. It used some other Qt DLLs from the path when starting the application. This fixed it:
xcopy /y c:\Qt\5.15.1\msvc2019_64\bin\*.dll deploy
I am trying to get Google Test v1.7.0 working with Netbeans v8.2 on Windows 10. I am using Mingw-w64 as the compiler and have installed the mingw-w64-x86_64-gtest package on MSYS2. I have set the console type to "External Console" in the project settings and have added -lgtest to the to the "Additional Options" line on the "Linker" tab in the "Test Files" folder settings. I have the bare minimal test application possible like so:
#include <gtest/gtest.h>
int main (int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
This seems to compile fine, but when I try to run it I get the following error:
0 [main] make 1060 C:\msys64\usr\bin\make.exe: *** fatal error - error while loading shared libraries: /C/Users/Ryan/AppData/Roaming/NetBeans/8.2/bin/nativeexecution/Windows-x86_64/unbuffer.dll: cannot open shared object file: No such file or directory
Any ideas on how to fix this?
EDIT, it seems that this is not unique to gtest, if I make a test using the Netbeans "Simple Test", which has no external dependencies, I also get the same error about unbuffer.dll
I had a similar problem using cppunit and found a solution that worked for me here https://bz.apache.org/netbeans/show_bug.cgi?id=269738
What I did is replace the offending unbuffer.dll file with "attachment 164026" file for 64-bit systems on the website. Afterwards the test compiled and ran properly.
Be sure to keep the old version of unbuffer.dll
I have made a small QT application and i am trying to run it thru command prompt on Windows:
#include <QMainWindow>
#include <QLabel>
int main(int argc,char* argv[])
{
QMainWindow a(argc,argv)
QLabel *NewLabel = new QLabel("Hi i am a label");
NewLabel->show();
return a.exec();
}
after doing qmake -project
and then qmake -TestPrg.pro
then i try make,here it fails with following error:
D:\TestPrg>make
make -f Makefile.Debug
make[1]: Entering directory `D:/TestPrg'
Makefile.Debug:58: *** missing separator. Stop.
make[1]: Leaving directory `D:/TestPrg'
make: *** [debug] Error 2
If we look at makefile.debug ,line number 58 and add a TAB before "<<",it complains at someother line number.So i feel there is something wrong in the compiler options ,can someone guide how to make it working.
Thanks alot
I have just made an example work on my machine. The code goes below, but you have at least a few mistakes, namely:
You use QMainWindow for being the application as it seems as opposed to QApplication. That is not going to compile.
Respectively, you would need to include QApplication rather than QMainWindow.
You miss a semi-colon after the first statement in the main function.
You construct a QLabel on the heap needlessly. In this particular scenario, it could be a simple stack object.
You use invoking qmake as qmake -foo rather than just qmake or make foo.
You are trying to use "make" in the Windows Command prompt as opposed to nmake or jom. If you use Visual Studio and MSVC, do not mix it with mingw, cygwin and other things. Just use nmake, otherwise, yes, use make for the latter options.
main.cpp
#include <QApplication>
#include <QLabel>
int main(int argc, char **argv)
{
QApplication a(argc, argv);
QLabel NewLabel("Hi i am a label");
NewLabel.show();
return a.exec();
}
main.pro
TEMPLATE = app
TARGET = main
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
SOURCES += main.cpp
Build and Run
* qmake
* nmake
* main.exe
I've install Netbeans 7.2 and Qt 5 on Windows7. Everything compiles fine.
But recently when I create a Qt form and try to use it in this way:
New Project > C/C++ Qt Application > Finish
Right click on new Qt project > New > Qt Form > Finish
After saving ui file in Designer
This error appears:
newForm.h:11:24: fatal error: ui_newForm.h: No such file or directory
The content of main.cpp is :
#include <QGuiApplication>
#include "newForm.h"
int main(int argc, char *argv[])
{
// initialize resources, if needed
// Q_INIT_RESOURCE(resfile);
QGuiApplication app(argc, argv);
// create and show your widgets here
return app.exec();
}
I tried to manually create ui_xwz.h file and add it to my project. But I want it work automatically as same as before. How can I solve it?
I have a ridiculous solution, Maybe we should report it as a bug to Netbeans or Qt.
Go and active QtSVG and QtXml modules of your project and rebuild it. I tested this way and the problem vanished.