I was trying to set up SDL2 on Mac Clion and XCode and both have occurred some problems. This is what I got from XCode:
2020-07-16 23:42:59.224392-0700 Trying_See_if_SDL2_Works[78612:8627338] Metal API Validation Enabled
2020-07-16 23:42:59.287864-0700 Trying_See_if_SDL2_Works[78612:8628129] flock failed to lock maps file: errno = 35
2020-07-16 23:42:59.288955-0700 Trying_See_if_SDL2_Works[78612:8628129] flock failed to lock maps file: errno = 35
Program ended with exit code: 0
And this is the code I used for testing: (C++)
#include "/Library/Frameworks/SDL2.framework/Headers/SDL.h"
#include <iostream>
int main() {
if (SDL_Init(SDL_INIT_VIDEO)!=0){
std::cout<<"SDL Init Error: "<<SDL_GetError();
return 1;
}
SDL_Quit();
return 0;
}
Can anyone give some advice on how to set up frameworks properly on Clion?
Related
I have recently started with C++ and am using Dev cpp as my IDE. But whenever I compile and run the program for Dev cpp, the program compiles successfully but while running the .exe file I get the following error:
--------------------------------
Failed to execute "C:\Users\Karan Gandhi\Desktop\Untitled1.exe":
Error 193: %1 is not a valid Win32 application.
Press any key to continue . . .
Here is my program:
#include <iostream>
using namespace std;
int main() {
cout << "Hello world";
return 0;
}
Please Note: I can successfully run the program from the terminal manually by just opening the file in the terminal: "C:\Users\Karan Gandhi\Desktop\Untitled1.exe"
Is there any way to fix this? Thank you!
I'm trying out OpenTracing Jaeger and have the following file test.cpp:
#include <opentracing/tracer.h>
#include <jaegertracing/Tracer.h>
#include <yaml-cpp/yaml.h>
#include <iostream>
void setUpTracer(const char* configFilePath)
{
auto configYAML = YAML::LoadFile(configFilePath);
auto config = jaegertracing::Config::parse(configYAML);
auto tracer = jaegertracing::Tracer::make(
"example-service", config, jaegertracing::logging::consoleLogger());
opentracing::Tracer::InitGlobal(
std::static_pointer_cast<opentracing::Tracer>(tracer));
}
int main(int argc, char* argv[]){
setUpTracer(argv[1]);
std::cout<<"Hello\n";
return 0;
}
And consider config.yml to be:
disabled: false
reporter:
logSpans: true
sampler:
type: const
param: 1
Now if I compile test.cpp with g++ test.cpp -lopentracing -ljaegertracing -lyaml-cpp and run ./a.out config.yml, I get a
ERROR: cannot connect to socket: Cannot connect socket to remote address { scheme="http", host="127.0.0.1", port=5778, path="/sampling", query="" }
While if I compile with g++ test.cpp -L /usr/local/lib -lopentracing -ljaegertracing -lyaml-cpp, I get a good
INFO: Initializing logging reporter
Hello
The contents of my /usr/local/lib are:
cmake libopentracing.so.1.6.0 libthriftqt.so
libjaegertracing.a libthrift-0.11.0.so libthrift.so
libjaegertracing.so libthrift.a libthriftz-0.11.0.so
libjaegertracing.so.0 libthrift_c_glib.a libthriftz.a
libjaegertracing.so.0.6.0 libthrift_c_glib.la libthriftz.la
libopentracing.a libthrift_c_glib.so libthriftz.so
libopentracing_mocktracer.a libthrift_c_glib.so.0 libyaml-cpp.a
libopentracing_mocktracer.so libthrift_c_glib.so.0.0.0 pkgconfig
libopentracing_mocktracer.so.1 libthrift.la python2.7
libopentracing_mocktracer.so.1.6.0 libthriftqt-0.11.0.so python3.6
libopentracing.so libthriftqt.a
libopentracing.so.1 libthriftqt.la
I'm using Jaeger in conjunction with a larger project involving ROS and get the same error even if I add_compile_options(-L /usr/local/lib) for CMakeLists.txt of the appropriate package; so, I wanted to better understand what the exact cause of the above error is, so hopefully that helps me to fix the one involved in ROS.
Thanks!
You are missing the configuration of Jaeger address. Since you did not provided it, it is trying to connect to the default one, which is TCP protocol, 127.0.0.1 and port 5778.
Check for details the configuration section here.
OpenCV version 3.4.3
Xcode version 10.1 (10B61)
macOS version 10.14.2 (18C54) Mojave
I am using C++ to run an extremely simple program.
This code is used to access the macbook webcam.
#include <iostream>
#include <opencv2/opencv.hpp>
int main() {
cv::VideoCapture camera(0);
return 0;
}
These are the messages from the Xcode console.
I couldn't find any resources to debug this situation.
CMIO_Unit_ScopeElement.h:200:SafeGetElement Throwing err: -67454
CMIOUnitFigBaseObjectImpl.c:246:CMIOUnitCreateFromDescription Invalid paramater
CMIO_Unit_Input_Device.cpp:244:GetPropertyInfo CMIOUInputFromProcs::GetPropertyInfo() failed for id 102, Error: -67456
CMIO_DAL_PlugIn.cpp:269:StreamCopyBufferQueue got an error from the plug-in routine, Error: 1852797029
CMIOHardware.cpp:339:CMIOObjectGetPropertyData the System is exiting
CMIOHardware.cpp:339:CMIOObjectGetPropertyData the System is exiting
Program ended with exit code: 0
I installed the latest version of opencv (OpenCv 3.0.0 Beta). I downloaded the opencv_contrib module and built it with opencv by doing a cmake (by following the instructions in the readme https://github.com/itseez/opencv_contrib). The build happened successfully. I wrote a simple program which uses creates a BasicFaceRecognizer model. However, when I compile my program I get the following error message
fatal error: opencv2/face.hpp: No such file or directory
#include"opencv2/face.hpp"
The code is very simple. Just wanted to check if it compiles before proceeding further.
#include"opencv2/opencv_modules.hpp"
#include"opencv2/face.hpp"
using namespace cv;
using namespace cv::face;
int main()
{
Ptr<BasicFaceRecognizer> model = createEigenFaceRecognizer();
return 0;
}
I have a problem using MySQL Connector for C++ in Xcode 5.
When I use the sql::Driver->connect I get EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
What I have:
64bit Boost libs (working)
64bit Mysqlconnector (dylib) + header files (which are in Xcode)
libmysqlcppconn.7.dylib and libmysqlclient.18.dylib are copied to the binaries directory for being loaded (if I don't have them there, it tells me it cannot find the images.)
Compiled with 64bit Intel
What I do:
try
{
sql::Driver *driver = get_driver_instance();
driver->connect(DBHOST, DBUSER, DBPASSWORD);
m_databaseConnection = driver->connect(DBHOST, DBUSER, DBPASSWORD);
m_databaseConnection->setAutoCommit(true);
m_databaseConnection->setSchema(DBDATABASE);
return true;
}
catch (...)
{
return false;
}
I've set a breakpoint above driver->connect and recognized that driver is set, so get_driver_instance() seems to work.
When calling its connect method, driver becomes NULL and the program crashes with bad access.
How can I solve this?