-shared : create a shared runtime -necessary for producing a shared library (DLL in windows-speak) -Wl,-soname,libHCI... : see above document re -soname linker option
The .o files are the object files to put in the shared library
You are correct about the other libraries. They get picked up by rpath and rpath-link, so that when you use then libHCI_VERSION_6622 library, you do not have to add them to the link command line
I need some general /generic advise how to tackle this problem.
It is in my C++ QT code and I cannot even start to debug at the beginning of the code.
I have a "main" wrapper app / project and bunch of subprojects.
I used to be able to set breakpoint at the start of the main project - not anymore.
I have no clue from where this error comes from and how it started on perfectly working code. .
I can disable all subprojects and still get this error.
terminate called after throwing an instance of 'std::bad_alloc'
I am not asking for code, just some advise how to tackle this error.
First, make sure you're creating a debug build. Whatever IDE you're using should have a Build or Compile config section, so take a look and make sure that's set. Your IDE should have a built in link to the debugger, so just run the program in the debugger. When the error is thrown, the debugger should stop the program and allow you to examine the state of the program. If you need to use the command line, here's an example to help you get started:
$ cat bad_alloc.cpp
size_t lim = 2;
int *arr = new int[lim];
lim *= 2;
$ # That will eventually try to allocate too much memory
$ # compile with gdb, in 32 bit mode to get a quick crash
$ g++ -m32 -ggdb bad_alloc.cpp -o bad_alloc
$ # debug the program
$ gdb bad_alloc
## GDB startup messages snipped out#
Reading symbols from bad_alloc...
Starting program: /home/ebacon/tmp/c++/bad_alloc
terminate called after throwing an instance of 'std::bad_array_new_length'
Program received signal SIGABRT, Aborted.
0xf7fce559 in __kernel_vsyscall ()
Missing separate debuginfos, use: dnf debuginfo-install glibc-2.32-10.fc33.i686 libgcc-10.3.1-1.fc33.i686
(gdb) # take a look at the backtrace
(gdb) bt#0 0xf7fce559 in __kernel_vsyscall ()#1 0xf7d2759a in raise () from /lib/libc.so.6#2 0xf7d0f3d0 in abort () from /lib/libc.so.6#3 0x0804c829 in __gnu_cxx::__verbose_terminate_handler() [clone .cold] ()#4 0x080dee78 in __cxxabiv1::__terminate(void (*)()) ()#5 0x080def01 in std::terminate() ()#6 0x0804dbb0 in __cxa_throw ()#7 0x0804a7ee in __cxa_throw_bad_array_new_length ()#8 0x0804d9f7 in main () at bad_alloc.cpp:8
(gdb) # all the frames except the last are part of the STL,
(gdb) # so we're probably only interested in frame 8
(gdb) frame 8#8 0x0804d9f7 in main () at bad_alloc.cpp:88 int *arr = new int[lim];
(gdb) # The 8 in the line above refers to line 8 of the source
(gdb) # print the value of lim
(gdb) p lim$1 = 536870912
A debugging session is active.
Inferior 1[process 3076940] will be killed.
Quit anyway? (y or n) y
Hopefully, that's enough to get you started. If you need more, then Google is your friend.
Thanks very much.
Since my program is "under construction" it always runs in debug mode.
The error I am getting does not even get me to the first line of code to set brake point.
Since last major change I did was to change the entire project from QT version 5.12.12 to 6.2.2. - that is the prime suspect.
Since then I found out that I can "configure" individual project to specific version....
In theory - first project I tried it did not work...
I appreciate your post, but since my backup works I will try to find out why the "disable versions prior to xyz " does not work first.
I need only one of the subprojects to be of latest QT version.
I think I need to withdrew this question.
After digesting more QT doc I realized that QProcess is NOT
starting a new thread , hence in my case of time consuming "scan" it is just
wrong to use it.
QT has a "concurrency" "feature" which does start multiple threads... ]
<pre>system("hcitool -i hci0 scan --flush ");
This "system call " works as expected - it finds nearby Bluetooth devices in allotted time - - up to 15 seconds. I use is instead of many "bluez" library derived function because it works CONSISTENTLY...
Because it blocks running thread for up to 15 seconds I like to utilize QT .
since hcitool is part of the bluez package, it almost certainly uses the bluez library to do its work. If you can get hold of the source code, you should be able to look through it and find out why they make it work the way you expect it to.
I did try "splitting " program and argument - it did not pass compiler.
Then I put all as a single parameter and it did not run at all.
<pre>OProcess.start("/bin/sh", QStringList() << "-c" << "hcitool -i hci0 scan --flush | tee >> /tmp/temp"); no tee ourput to console - not that important
qDebug() << OProcess.state(); returns "process starting" expected
qDebug() << OProcess.state(); returns "process starting" sort of expected
qDebug() << OProcess.state(); return process not running expected
OProcess.execute("hcitool-i hci0 scan --flush >>/tmp/temp");
qDebug() << OProcess.state(); return process not running not surprised
qDebug() << OProcess.state(); return process not running obvious
I am under the impression that "hci" was first - then "bluez" - based on "hci"
The QT implementation of bluez is missing the "--flush" option in "scan".
That keeps QT from actually scanning for devices and that is of no good....
In my c++ code I am loading parent.htm and want to get above message 'clickSample' in
Issue that I am facing : by doing like above I am not getting this message in code. If I post any message from parent.html then I can get it. But if I do like from child.html then it never come to c++ code.
Is there the way to do so?
Is it something like I need to catch the message at parent.html first then post again to c++?
It depends what you are trying to do with the content of the string. The CString is using Unicode, so presumably, the entire application is also. And you cannot (easily) change one part of the application without affecting other elements.
I have a lot of my pieces in place from my windows client debugger setting breakpoints stepping thru code I just created this project to finish off the last piece displaying modifying storage
As whenever I have to re-test in my development project I have to reinit my machine ( long story) don’t know how I unicode got set
It sounds like something is messed up in your project. Your source files should be dependent on all the associated headers, and if a header changes then the sources should be rebuilt. You need to look at the project settings for all the source files.
Richard you are right I copied a .cpp and .h from another project instead of instead of going to Add --> exiting item I guess I should delete and recopy ? I mean copy a copy to another directory and then delete and then do add -> resource item