Qt error exit code -1073741515 (0xC0000135) - c++

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.

Related

Simple C++ program failing on windows [duplicate]

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?).

Running c++ in terminal and got "fatal error: 'iostream' file not found"

I am very new to c++ and when I ran the script
#include <iostream>
using namespace std;
int main() {
cout << "Hello World!" << endl;
cout << "Another message";
return 0;
}
in the terminal cpp test.cpp, I got this error message:
test.cpp:1:10: fatal error: 'iostream' file not found
#include <iostream>
^~~~~~~~~~
1 error generated.
I am using clang as compiler on Mac. The text editor is VS Studio code. The strange thing is that when I run the script in VS Studio code via the extension "Code Runner", it works just fine.
I know there are several other similar questions being asked, but I cannot understand how they solved the question. Can anyone give me some step-by-step instructions? Thank you so much !
It turns out that just adding gcc test.cpp -lstdc++ in the terminal solves the problem.

Running OpenCV Program on Windows

I have a simple test program for OpenCV:
#include "opencv2/opencv.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgcodecs/imgcodecs.hpp"
#include <iostream>
int main(int argc, char **argv){
std::cout << "HELLO" << std::endl;
cv::Mat im=cv::imread((argc==2)? argv[1]: "testing.jpg",cv::IMREAD_COLOR);
if (im.empty()){
std::cout << "Cannot open image." << std::endl;
} else {
cv::namedWindow("DisplayWindow",cv::WINDOW_AUTOSIZE);
cv::imshow("DisplayWindow",im);
cv::waitKey(0);
}
return 0;
}
However, when run the program does nothing. Hello is not printed to the console, and it does not output an error.
./main
#Nothing.......
It is worth noting that the program terminates, but not in the proper way. (The return value is non-zero) I do not think that this is a linking error, as those would actually output an error.
Any ideas on what is happening and/or how to fix it? I am using a Windows computer if that changes anything.
Turns out the windows cmd prompt actually has some use. (VERY surprising, I gave up on it a long time ago)
I ran the test program from the windows cmd line and it said the following libraries were missing.
libstdc++-6.dll
libgcc_s_dw2-1.dll
libwinpthread-1.dll
To fix the standard C++ and C libraries I just statically linked them using the below command. (This is apparently a common practice on Windows due to issues with version control):
g++ -static-libgcc -static-libstdc++ ...rest of compile/link cmd...
To fix the winpthread dll I just copied the dll to the bin folder of my program and everything worked!

How to run c++ program in codeblocks?

i write a simple progrum in c++ and run using codeblocks(13:12). My code looks like -
#include <iostream>
using namespace std;
int main(){
cout << "hello" << end1;
return 0;
}
but it's don't build. it gives me an error message .
s Mine\c++ pro. . . 1 fetal error: No such file or directory
Why i am getting this issue ? Why the iostram file don't found . Whats the wrong with it and how to solve it ?
I am not sure about the error you wrote, but I think that your compiler might not be installed. I suggest you to unistall CodeBlocks and re-download the installer from http://www.codeblocks.org/downloads/26 that has the compiler already installed: codeblocks-16.01mingw-setup.exe from the link.
Good luck, pal!
EDIT 1: The script is fine, don't worry about it.
EDIT 2: Oops, I now see that you have a fault in your code. It's endl, not end1!

Required file "tracker.exe" is missing

First time using Visual C++ in Visual Studio and I'm trying to teach myself C++ from some books. I am just trying to do a basic "Hello World" program and its getting a couple errors that I don't know anything about, as well as a bizarre warning. The missing source file seems to be standard and I can't figure it out.
The errors:
Error 2 error : Required file "tracker.exe" is missing.
Error 3 IntelliSense: cannot open source file "SDKDDKVer.h"
The warning:
warning MSB8003: Could not find WindowsSDKDir variable from the registry. TargetFrameworkVersion or PlatformToolset may be set to an invalid version number.
The code:
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!" ;
// This prevents the Console Window from closing during debug mode
cin.ignore(cin.rdbuf()->in_avail());
cout << "\nPress only the 'Enter' key to exit program: ";
cin.get();
return 0;
}
Any explanations or help would be huge! Thanks.
Here's a standard C++03 "hello, world!":
#include <iostream>
using namespace std;
int main()
{
cout << "Hello, world!" << endl;
}
Turn off precompiled headers in the project settings. Make that compile without adding anything. Run it via Ctrl F5 (alternatively place a breakpoint on the final } and run it via the debugger, e.g. keypress F5).
If that doesn't work then you have configuration error. Then try first a new project. If that doesn't work, uninstall VS and reinstall it.