I have been testing the VS2017 Linux C++ with remote debugger on Linux Ubuntu.
I have created a few example projects for C++ and everything has been working great until I got to threading examples.
I cannot seem to get the threads to compile as I keep getting "undefined reference to `pthread_create'" error. I know the solution to this is to add -lpthread or -pthread to the VS project properties command line but this does not seem to work in this case.
If anyone has got this working could you please point me in the right direction.
linker->input->library dependencies pthread
Related
After the setup I've done in the properties of the project: at C++Compiler and Linker in both Release and Debug configurations I tried to build the project, which went successful.
Then I decided to run it and had some difficulties: using External Terminal, that did absolutely nothing, Standard output, that showed some text related to dll files I've clue about, Internal Terminal, that showed the very same text.
After that didn't work I went for cmd execution and what I saw was this.
Could you explain what that means and what I'm supposed to do. I'm new to all that kind of stuff, so I apologise if I did something stupid.
Cheers
EDIT: If not seen, I'm using Windows 10 and the version of SFML is GCC 7.3.0 MinGW (DW2) - 32-bit
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.
I set up OpenCV with Code::Blocks as per this tutorial: http://kevinhughes.ca/tutorials/opencv-install-on-windows-with-codeblocks-and-mingw/.
I've got as far as building the test program at the end successfully, but when I try to run it I get the following error: "The application was unable to start correctly (0xc00000be). Click OK to close the application."
The one thing that is certainly different from the tutorial for me is that I'm working with OpenCV 3.0.0, Code::Blocks 13.12 and the latest version of mingw (number not obvious from their website or the installer).
I found that other people had had this problem in the past, e.g. The application was unable to start correctly (0xc00000be)
However, it has been a long time since that thread was active, I'm working with newer versions of the software and, most importantly, the answer given there didn't help (I compiled openCV with the same mingw that I'm using with Code::Blocks), so I thought this question would be worth asking (sorry if it's not, I'm rather new to this).
Could anybody suggest a fix that might get rid of this error?
A few other things to note:
I didn't download the Code::Blocks that came with mingw as I was advised against it, I got them separately as per the tutorial
I have installed OpenCV and Code::Blocks on my E: drive, though mingw is still on my C:.
I have added both mingw and OpenCV to my PATH variable, and mingw to my Path variable
I have linked the libraries in both the main compiler settings for Code::Blocks and the Build Options of my project.
I'm working from a 64-bit Windows 7 Laptop, but I have done everything 32-bit style as advised in the tutorial.
Thanks in advance!
So, one solution I've found to this problem is to copy all the .dll files from "...\opencv\build\x86\mingw\bin" to the project file (build directory).
Having done that, the project will run fine. This still doesn't (directly) explain why it wont run without those files (at least, several sources including the tutorial imply it should), and so isn't really optimal. I will continue to look for a solution for this so I don't have to clutter every opencv project I make with the .dlls.
However, for anyone simply wanting to get stuck into coding who is having this problem, I recommend that solution.
I'm trying to get C++ working properly in Eclipse but it seems that anything except the normal MinGW is failing and I have no idea what I'm doing.
Reason I'm trying this is because MinGW complains about to_string() not existing in the std library and I've read that this was fixed in MinGW-w64.
I've downloaded MinGW and MinGW-w64 to separate folders, currently MinGW is included in PATH.
When I change my project properties [C/C++ Build -> Environment] variables to go with MinGW-w64 the stuff still builds but crashes when I try to run it.
I'm trying to build a win32 app (#include <windows.h>)
Flags in [C/C++ Build -> Settings -> GCC C++ Compiler -> Miscellaneous]: -c -fmessage-length=0 -std=c++11 -mwindows
I've also included a Pre-build step: windres ../src/resources.rc -o ../Resources/resources.o
And for some reason it compiles without error, but when I try to run the binary.exe it just crashes (which it didn't with normal MinGW).
I've also looked into Cygwin but I have no idea what packages to download and I can't even find the std library, let alone the windows library, in the massive massive list of installable packages.
I also don't want to use Visual C++ because that requires you to install Visual Studio (an IDE I loathe because of reasons(yes, multiple))
I'm doing the minor "Games Programming" and my school is giving us a crash-course C++ (which exists of six 3 hour long lessons to get a grasp of the basics) to use in building a simple game application. Problem is the teachers are Visual Studio fanboys and don't really know anything outside of that environment (most of 'em don't really seem to care either for that matter).
I'm having a lot of trouble setting this up with no prior experience in C++ and a very janky C++ support for windows. ( I do know my fair share of Java (in Eclipse) and a bit of C# )
I've been searching for at least an hour without any results.
If I forgot to write down stuff or am being a total idiot here please do enlighten me.
Any help is much appreciated
Edit: I'm suddenly getting other error output <- forgot to clean before building
Edit edit: the error:
(hi is the icon)
Another Edit:
if I debug it breaks at No source available for "main() at 0x4081a9" which makes sense because I didn't make that kind of main because I'm writing a windows app. if I press continue it runs (what?) but then when I close it I see the following output:
C++ Win32.exe
~"[Inferior 1 (process 7012) exited normally]
"
gdb
[New Thread 7012.0x1d14]
Temporary breakpoint 1, 0x00000000004081a9 in main ()
Quit (expect signal SIGINT when the program is resumed)
I have been trying out using Eclipse CDT for a course I am taking. Previously I have been using Visual Studio Express but since that requires me to be online and I have to use the IDE+compiler offline, I switched to Eclipse + Cygwin GCC.
Now everything was working prefectly, until I got an error about file paths in my make file. After reading some of the posts online, the issue seemed to be that Cygwin's make does not resolve absolute Windows file paths because of the ':' symbol and confuses it with a new target definition. The proposed fix was to download a fixed make file. I diligently did so and the programs would compile fine.
But after I went into the first debug session, everything froze. I aborted eclipse and tried a clean build but now the compilation wont happen AT ALL, which is very weird for me.
I can't find a post for a similar problem so I am really stuck now. I was currently working the assumption that my CDT may be corrupt or something so I downloaded Eclipse Luna just today and tried building using that, but no joy. Even a fresh project in a new workspace wont compile.
Appreciate the help in advance.
Did you try redownloading Eclipse? Sometimes Eclipse gets a fatal error glitch that makes it unable to compile anything. I've had this problem before, the only way i was able to fix it was to uninstall and re download the latest version. If this doesnt work, try switching to Bloodshed Dev C++ or codeblocks.
So it seems like an issue with the new make (v3.80). upgating it to v4.08 fixed the issue of not building.
Version 4.08 however does not fix the Windows file paths not being recognized properly and treated as a target definition. I am still getting the multiple target patterns. stop error.
EDIT: Found this on Stack overflow to solve the issue... should have searched better previously.
Very simple application fails with "multiple target patterns" from Eclipse