mariadb connector/c++ : /usr/bin/ld: cannot find -lmariadbcpp - c++

im pretty much new to c++ and im currently making a project where i need to connect to a mariadb database, so I investigated and found the official mariadb connector/c++, but im not sure if this is the way most people go... so if you have a better aproach to conect to a mariadb server using c++, please tell me bellow.
Im also using gradle for my project, so if you know how to solve my issue using gradle i'd be graceful.
Anyway, the issue is that when i follow the official guide
https://mariadb.com/docs/clients/connector-cpp/#building-the-c-application
and compile with
g++ -o app.exe app.cpp -std=c++11 -lmariadbcpp
i get the following:
enter image description here
and got no idea what to do about it.
Again, maybe I'm going the official way, but also the dumb/bad way?, and if not, how could i do it using gradle?
Thank you for your time! ^-^

When compiling whith gcc or g++ for the missing library.
You have to make shure every install command works from the mariadb official guide, since the guide is deprecated and some folders and/or files have changed names, which will cause your install commands to fail.
In my case was the fact that the downloaded file contained lib64 instead of lib as the guide suggests, but keep in mind there may be more...

Related

Trying to use Eclipse for c++ project on Mac

I am a total noob at programming and IDEs. I am attempting to open a project for some research that I am doing. I have a Macbook Pro using Mac OS High Sierra 10.13.6.
The project that I'm trying to open is a c++ project, but every time I open it, there are error messages everywhere. It appears that the header files aren't even being recognized. A screenshot is linked below. From what I've read so far, the issue seems to be that I don't have a proper debugger for c++. I downloaded XCode after I downloaded Eclipse like some guides have recommended, but it still hasn't fixed the issue.
Other sources I've found on this site use highly technical language (Eclipse GDB MacOSX Mavericks), so I'm struggling to figure out how to fix the problem. If anyone has any ideas, I'd love to hear them.
Here is a better solution for beginners.
Create a file called HelloWorld.cpp
and copy paste the following inside:
#include <stdio.h>
int main(int argc, char **argv)
{
printf("Hello world\n");
return 0;
}
Then open your terminal ( like that ) and write this:
$ g++ -g -o main HelloWorld.cpp
If this goes smooth it means you have gcc installed (good!).
After that try to run this:
$ gdb ./main
If this goes smooth it means you have gdb installed (great!).
Move to create a new Eclipse project with this file only
and update your post if there are any problems.
If this goes smooth gradually migrate your stuff to HelloWorld.cpp.
If gcc or gdb steps above fail, you have to install them first.
There are many online guides on how to do that. Good luck!
I am by no means a Mac expert or do I know much about eclipse CDT or Xcode but I can offer what I know. This is not a complete answer but I just want to share as I also know what it is like to struggle with C code on OSX.
First,
You need to make sure the C/C++ compilers are installed on the Mac properly. They come with XCode and I believe the compiler is Clang. Then you need to make sure the standard libs were installed correctly.
That whole issue is your first problem and should be asked to an XCode programmer and what not.
Second, to use eclipse CDT you need to tell it where and what compiler you are using. As well as the linked and debugger. You can do this in the project properties or settings. The stuff should usually be put in the path variable but once eclipse CDR knows where to find all that and everything is installed correctly it should pick up the header files and then include them in every project!
That’s all I can really provide you and I hope you can find out more.

MySql connector-c++ wont link in QtCreator but works fine locally on raspberry pi3

Firstly, thank you in advance for at least reading this question.
Secondly, feel free to call me an idiot if this is a "no brainer"
Now down to the issue at hand...
I am running Ubuntu 16.04 (64bit) with QT Creator as my IDE and on the whole it works great. I can cross compile for the Raspberry Pi3 (running raspbian) and also compile plugins for X-Plane.
Everything was going great until I needed to implement MySql into my project. That's when it all went south.
I can not use the Qt library for this as X-Plane does not like anything Qt related in its plugins. But that is fine, I have connector-c++ working on that machine and it connects to my MySql server and does everything it's supposed to.
I think I have read just about every forum and watched every youtube video on this but can not get Qt Creator to compile with connector for the raspberry pi.
I wrote/compiled a test app locally (with g++) on the pi and it works great. However for some reason (government plot maybe?) it refuses to link the libraries when compiling under Qt Creator.
The error I get when compiling in QtCreator is:
undefined reference to `get_driver_instance'
Currently,
I have followed the instructions for setting up a cross compiler here:
https://wiki.qt.io/RaspberryPi2EGLFS
Downloaded the connector code from here:
git clone https://github.com/mysql/mysql-connector-cpp
I have followed the instructions for compiling connector-c++ here:
https://dev.mysql.com/doc/connector-cpp/en/connector-cpp-installation-source-unix.html
And I have banged my head 1000x on a brick wall here:
(picture of blood stained wall not available)
Also, I have tried compiling connector on my Ubuntu pc with paths to the pi's sysroot etc. but i think it made a 64bit version which causes Qt Creator to have a dummy spit about "unrecognized format".
I am hoping that this is just me having a "senior moment" and that someone can point me in the right direction.
To save putting up irrelevant logs/code I will wait until someone asks for it and then copy/paste what they need.
Again, thanks in advance and know that I will be eternally grateful for any light on this matter (preferably before I go even insanerer)
Well after 2 weeks of pain, I have solved this problem. Here is what I think is the issue:
Firstly, I found that mysqlcppconn is not needed (at least for me) and used the mysql libraries in /usr/lib
Secondly, the symlinks to libmysqlclient.so.6.0.22 were by default:
libmysqlclient.so.6 -> libmysqlclient.so.6.0.22
The compiler was looking for libmysqlclient.so which didn't exist. So I created the link (libmysqlclient.so -> libmysqlclient.so.6) and it worked!!
Thanks to all who helped.

OpenCV haartraining: Mergevec error: Input file does not exist or not readable

Following this tutorial, I've created my positive samples but need to merge them now, using mergevec. I downloaded the mergevec.exe binary file provided and got the two required dlls cxcore100.dll and highgui100.dll. However, when I run it like so:
mergevec samples.txt samples.vec
it gives me the error:
ERROR: Input file <filename> does not exist or not readable.
What should I do to fix this? My vec files are fine, because I was able to view them using the opencv_createsamples utility. So I know they're fine.
I ran into this issue as well and made a python utility that combines .vec files to avoid installing openCV again: https://github.com/wulfebw/mergevec
Hope it helps.
I was in the same situation as you few days ago so i'll try to help you out =P.
First of all i am interested to know where you found the mergevec.exe, because it isn't available to download anymore if i recall. I ask because i think that you might have downloaded an exe compiled on Linux. I had the same error when i tried to execute the mergevec, i had compiled on Ubuntu, on my Windows computer. Even with the 2 dlls.
As i explained it here , The mergevec from Naotoshi was originally made for Unix distribution, so under windows you will encounter a lot of problems. I first tried to do it on windows but i abandonned because it was too complicated and even with a full Cygwin installation i could not compile the mergevec.cpp.
What i advise you to do is to create yourself an Ubuntu virtual machine and to compile your own mergevec.exe. Once done you can copy your vec files in your virtual machine and merge them under Ubuntu. After this you can bring back the merged vec file to Windows if you want (It is better to not run the training under a VM: less computation power).
Here is what i did:
Installed VMware player with Ubuntu 14.0.4 (although i don't recommend it, still some bugs)
Installed OpenCV from the sources with TBB. There are a lot of tutorials, but the only one that worked for me is the OPenCV website, they are the more accurate on the libraries you mandatorily need.
I downloaded the GitHub classifier training and then I followed the commands given and it worked well.
If you encounter any library problem or OpenCV Installation issue don't hesitate i went through them too.

missing required architecture x86_64 in file opencv

experts:
I am trying to create a C++ framework using Xcode. My framework depends on OpenCV. I am having the same issue as other have had to deal with. I found a likely answer here but when I try to copy the following code into my Prefix.pch file
#ifdef __cplusplus
#import <OpenCV/opencv2/opencv.hpp>
#endif
I get this error when I try to build: 'OpenCV/opencv2/opencv.hpp' file not found
Now, I know that it is because I'm using the opencv2.framework. So my question is:
"How do I reference that in my Prefix.pch file?"
Thank you for your help,
Lucy
-------------------------------------------------- More Info -----------------------------------------
I tried to add the framework but that isn't working. Is there something else I need to do?
I was compiling to 64-bit and OpenCV does not support that. Maybe because of cross architecture support. We changed to Universal (32/64-bit) and that seemed to make it work. There were a few more Xcode configurations that needed to be tweaked but that was the reason for the error.
Another possible option (which happened to me) is that you have accidentally downloaded the wrong OpenCV framework. For example you might have downloaded the iOS one in which case the correct architecture wont exist for your mac. Make sure to download and then extract the right version from the opencv website to a unique folder.

OpenCV - How do I get started?

I just don't seem to be able to get OpenCV to work properly. Here's what I want to accomplish:
Use CodeBlocks (which I installed using codeblocks-10.05mingw-setup.exe) with OpenCV (installer: OpenCV-2.4.2.exe) on my Windows x64.
I've tried a lot of different configurations which will only bother you if I posted them all, so I hope you don't mind if I just ask the simple question: how do I get this to work?
I think I'm missing the smallest detail right now, so a detailed description of how to get started would be welcome.
If the OpenCV installer did the job, you should have by now OpenCV libraries and headers already installed in your system.
I would then go ahead and try to compile a hello world basic code, like the one you can get from here. If you would like to program using an IDE, like VisualC++ in Windows, you can follow this guide that will help you setting up the environment.
OpenCV team just introduced their new web site. There you can find Introduction to OpenCV section with installation instructions, including detailed instructions for Windows. Don't forget to cleanup your system before installation to avoid problems with mixing different install options. If you still can't get it working with CodeBlocks, follow Dan's advice and try compiling from command line.
When you are done with installation, go on and read there great new tutorials!