Simple C++ program failing on windows [duplicate] - c++

This question already has answers here:
Process exit code 0xC0000135 while running Qt hello world
(1 answer)
cLion + Qt5 - exit code -1073741515 (0xC0000135)
(1 answer)
Qt error exit code -1073741515 (0xC0000135)
(1 answer)
Closed 5 months ago.
I am little new to windows platform and I may be getting something entirely wrong.
I have this simple program in C++ with Qt.
#include <iostream>
#include <QWidget>
#include <QApplication>
int main(int argc, char **argv) {
QApplication app = QApplication(argc, argv);
std::cout << "abc";
app.exec();
return 0;
}
I was able to succesfully build and link it, however when I try to run it:
Process finished with exit code -1073741515 (0xC0000135)
appears.
I think problem is with the loader so I added C:\Program Files\Qt\6.3.2\mingw_64\lib to the path, did not help.
Any ideas ?
I am using CLion, mingw, cmake, Qt6.
Update:
Using dependency walker, I got the following result:
Error
Also, this is quite new computer (may be a problem?).

Related

Qt error exit code -1073741515 (0xC0000135)

I am new to Qt. I was trying to use Qt in CLion and have already modified the CMake settings in CLion to make it use the CMake in Qt. Then I wrote a piece of test code:
#include <iostream>
#include <QApplication>
#include <QDebug>
int main() {
std::cout << "Hello, World!" << std::endl;
qDebug() << QT_VERSION_STR;
return 0;
}
The Build succeeded, but when I try to run it the error Process finished with exit code -1073741515 (0xC0000135) occurred. Could anyone give some instructions on why this error occur and how to fix it?
Problem solved by adding C:\Qt\Tools\QtCreator\bin and C:\Qt\5.15.2\mingw81_64\bin to the environment variable PATH. These two paths could be different depends on where you install Qt.
NOTE: Only add C:\Qt\5.15.2\mingw81_64\bin did not solve this problem.

Code::Blocks and Qt4

I´ve been trying desperately to get Qt4 running on my Code::Blocks. I´ve found the following page, with instructions I followed (German):
http://www.heikogorski.de/Compiler---Code/QT-und-Code--Blocks/qt-und-code--blocks.html
I downloaded Qt 4.8.2 like in the tutorial, checked every path 3 times and still, once I try to run the following very basic code:
#include <QApplication>
int main(int a, char ** b)
{
QApplication app(a,b);
return app.exec();
}
the window will just crash and I get the following error message in debugger:
Exception error at 0x6E1CC9A4 (QtCore4.dll) in qttest3.exe:
0xC0000005: Acesss violation at adress 0x01040806
Does anybody have an idea why?

Simple C and C++ executable programs hang in Windows 7 [duplicate]

This question already has an answer here:
Trying to setup a C programming environment [closed]
(1 answer)
Closed 7 years ago.
Recently I decided to start coding again in C and C++, so I downloaded Dev-C++ and wrote the standard C Code for "Hello, World!" shown below:
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
printf("Hello World");
return 0;
}
Upon completion, the code compiled with 0 errors or warnings; however, I have a strange problem with running the executable. I'm writing and compiling on Windows 7 machine, and when I open the executable, the command prompt doesn't open to show the resulting program's text, which is what I was told would happen. Opening the Task Manager shows that there are three instances of the executable running at once, and they cannot be terminated with the "End Process" button. I've attempted to compile the same code in two different compilers (i.e. GCC, and Visual Studio) in C and C++ with the same results occurring in both additional environments. It may be worth mentioning that it's a home-build PC, but this is the only software issue I've encountered so far and the OS is a clean install.
Program may be hang if you use antivirus or windows defender. Please disable it and try again

GTKmm3 (GTK+ 3 C++) compiles but throws GLib-GIO-CRITICAL error when run

I've just started trying to get GTK+ 3 working with C++ and have tried to compile the simplest GTKmm Hello-World example.
#include <gtkmm.h>
int main(int argc, char *argv[])
{
Glib::RefPtr<Gtk::Application> app =
Gtk::Application::create(argc, argv,
"org.gtkmm.examples.base");
Gtk::Window window;
window.set_default_size(200, 200);
return app->run(window);
}
After compiling with:
g++ simple.cc -o simple `pkg-config gtkmm-3.0 --cflags --libs`
There are no errors, however when I run the newly compiled application with:
./simple
I get the following error:
GLib-GIO-CRITICAL **: g_application_list_actions: assertion `application->priv->is_registered' failed
Segmentation fault (core dumped)
The code has been copied, unchanged from https://developer.gnome.org/gtkmm-tutorial/stable/sec-basics-simple-example.html.en so presumably it's likely to be a configuration issue, however I've frequently used this machine for PyGtk and CommandLine C++ without any issues.
Any help would be greatly appreciated.
This was a bug in gtkmm (probably triggered by a change in GTK+) that has been fixed in gtkmm:
https://git.gnome.org/browse/gtkmm/commit/?id=506cba376c0a0e09217ad7f5d597b6723d7f91a6
Maybe you can update your gtkmm version.

Qt4.8.1 undhandled exception at QMdiArea::addSubwindow

I compiled Qt 4.8.1 with these instructions:
http://www.holoborodko.com/pavel/2011/02/01/how-to-compile-qt-4-7-with-visual-studio-2010/
for my system (Visual Studio 2010, x64). The compilation worked and everything seemed Ok.
While compiling there is a lot of output, but it's very fast and therefore I can't read it so i suppose that shouldn't be a problem.
After I compiled succesfully my current project I got an unhandled runtime exception. After a while I discovered that it comes from the QMdiArea::addSubwindow function, which seems to throw the exception (I'm not able to catch it with overriden notify function though). So I searched for an example project to see if it's my code or something else. I found this example here:
http://www.codeprogress.com/cpp/libraries/qt/qMdiAreaAddSubWindow.php
And it works fine in 32bit mode as well as debug mode of x64, but again at the
QMdiArea::addSubwindow function there is an unhandled exception. Has anyone an idea what's wrong or had the same problem?
Currently I'm recompiling Qt to get the debug information again (i cleaned it beforehand).
But maybe someone had the same problem and a solution for me.
//Update:
The code is here (the exact same as in the link)
#include <QApplication>
#include <QMainWindow>
#include <QMdiArea>
#include <QMdiSubWindow>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QMainWindow window;
window.setFixedSize(800,600);
window.setWindowTitle(QString::fromUtf8("My QMdiWindow"));
QMdiArea* area = new QMdiArea();
area->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
//Create QMdiSubWindow
QMdiSubWindow* subWindow = new QMdiSubWindow();
subWindow->setFixedSize(200,100);
//Add subWindow to Main QMdiWindow here
area->addSubWindow(subWindow);
window.setCentralWidget(area);
window.show();
return app.exec();
}
//Update2:
I opened another discussion here.
Ok, I found the problem. It is a bug in the MSVC++ compiler. Installing the service pack and recompiling Qt again helps.