I wrote a simple console application, and tried to debug it. But when I start debugging, in application output appears this message: Run in Terminal is not supported with the LLDB backend..
I use Qt Creator 4.1.0 on Mac OS X 10.11.
Here is an example of code that I tried to debug:
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int a;
cin >> a;
cout << "a^2 = " << a * a;
return 0;
}
I also met this problem.
If I create a new C/C++ (Non-Qt project), the debugger doesn't work. However, if I create a Qt console project, the debugger works well.
There is the gdb debbugger wich is the GNU debbugger.
Here there is a tutorial
Related
I made a new command-line tool C++ project in Xcode, with the following main.cpp:
#include <iostream>
int main() {
std::cout << "Hello, World!\n";
}
When I try to profile it in Instruments with any template, I get the following error before my program even starts:
Failed to execute loader thread for /Applications/Xcode.app/Contents/SharedFrameworks/DVTInstrumentsFoundation.framework/Resources/liboainject.dylib in target; target process <pid> likely exited
I get the same error when I try running Instruments with xctrace.
How do I get Instruments to properly load my programs?
Setup:
Xcode version: 13.4.1 (13F100)
Hardware: 2020 M1 MacBook Air
I created a simple Hello World program to test MPI like described by Microsoft Code is:
#include <mpi.h>
#include <stdio.h>
int main(int argc, char** argv) {
printf("Hello");
int node;
// Initialize the MPI environment
MPI_Init(&argc, &argv);
// Get the rank of the process
MPI_Comm_rank(MPI_COMM_WORLD, &node);
// Print off a hello world message
printf("Hello world from node %d\n",node);
// Finalize the MPI environment.
MPI_Finalize();
}
Programs compiles without error:
But in order to get the program running i need smpd manager and mpiexec which is not part of the ms-mpi installation. And as my computer is running with windows 10 i'm unable to install Microsoft HPC. Is there a way to get a mpi program running on a desktop with several threads?
It's not the Microsoft HPC Pack needed to run MPI programs on desktops but the Microsoft HPC Pack SDK . Slight but important difference.
I'm trying to read some frames from the built-in camera of a Macbook pro using opencv 4.1.0 with c++. Below is the code I have:
#include "opencv2/opencv.hpp"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgcodecs.hpp>
#include <iostream>
#include <unistd.h>
using namespace cv;
using namespace std;
int main(int, char**) {
VideoCapture cap(0);
if(!cap.isOpened())
cerr<<"Error! unable to open camera!";
return -1;
cout << "Start grabbing" << endl
<< "Press any key to terminate" << endl;
Mat frame;
namedWindow("Live");
for (;;)
{
// wait for a new frame from camera and store it into 'frame'
cap.read(frame);
// check if we succeeded
if (frame.empty()) {
cerr << "ERROR! blank frame grabbed\n";
break;
}
// show live and wait for a key with timeout long enough to show images
imshow("Live", frame);
if (waitKey(5) >= 0)
break;
}
return 0;
}
When calling
VideoCapture cap(0);
the error I'm getting is:
testApp[11889:464240] +[AVCaptureDevice authorizationStatusForMediaType:]: unrecognized selector sent to class 0x7fff9f79cd50
[ERROR:0] VIDEOIO(AVFOUNDATION): raised unknown C++ exception!
I tried replacing 0 with other indices, but none of them work. Anyone know what is going on?
What version of macOS are you running on? I had the exact same issue but in Java. I solved it today by upgrading my OS from High Sierra to Mojave version 10.14 and updating the Xcode command line tools in the terminal using xcode-select --install.
I think the reason we got this problem is that Xcode command line tools - which provides the api (AVFoundation) to access camera on macOS and ios - was too old and therefore not compatible with the newly released OpenCV4.1.0. So my suggestion would be try to update your Xcode command line tools. In my case, I needed to upgrade my OS in order to get a newer version of it.
I had the same issue but in python. I wanted to access the webcam and capture images, but continued to get this error. What solved my problem was a simple SMC reset of the macbook.
On Mac OS X the debug outputs go to the system logger that can be read with the Console Application. But when you are developing outside of Xcode (using QtCreator or just the terminal for example), it's not very practical to check the system logs for debugging.
Is there any way to force MacOS to print the backtrace to the terminal (similar to Linux behavior) without any trick on the application side ??
I'm developing a new feature for Clang so it's a C++ program. And I'm using MacOS 10.13.3.
If you are using qt, then include QDebug and then use qDebug() as follows:
qDebug() << debug_qstring;
And if you are using XCode and ObjC, look for NSLog.
void NSLog(NSString *format, ...);
Also printf in case of C and std::out in case of cpp are always your friends!
After downloading the latest toolkit and compiling/running the code that I currently have, I get a debug assertion error with any sort of file IO functions. Even the code below will exit with an assertion error when fprintf is called.
//main.cu
#include <stdio.h>
#include <stdlib.h>
int main ( void ) {
FILE* foo;
foo=fopen("C:\\asdfsa.txt","w");
fprintf(foo,"wtf\n");
fclose(foo);
return 0;
}
I am using CUDA toolkit 5.0, and Visual studio.
Any idea on what is going on? My code worked fine on my older computer with an old version cuda toolkit.
Check the fopen return value. Looks like you are running the code on the entirely new environmnent - maybe you can't create the file in the C:\ (e.g. this may require admin permissions)