|
Where exactly did you find that file?
|
|
|
|
|
Salvatore Terress wrote: #include <dbus/dbus-signature.h>
compiler l,fails to "find" this file ONLY
#include <dbus/dbus-syntax.h>
You can verify this by deleting the first file - then you should get the error for that first file. If you delete it and the error does NOT occur then you are looking at the wrong directory.
But if those two files are in the same directory then the problem is a permission problem.
Probably with the file.
But there are other possible variations such as that the file is actually a link and the link location (hierarchy) has a permission problem.
|
|
|
|
|
!!! pkg-config is your friend !!!
Here's a very simple program that #includes <dbus/dbus.h>
#include <iostream>
#include <dbus/dbus.h>
int main()
{
std::cout << "Hello World\n";
}
Clearly, this does nothing but print "Hello World", but does ask the compiler to #include <dbus/dbus.h>
If we try to compile this naively, the compiler complains that it can't find the requested headers
k5054@localhost:~/tmp $ g++ hello.cpp
hello.cpp:2:10: fatal error: dbus/dbus.h: No such file or directory
2 | #include <dbus/dbus.h>
| ^~~~~~~~~~~~~
compilation terminated.
pkg-config --cflags dbus-1 returns the magic needed to find the headers:
k5054@localhost:~/tmp $ pkg-config --cflags dbus-1
-I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include I've been over this before in answer to your question in QA I think, so I'm not going to repeat it here.
We can use some shell "magic" to tell the compiler to use pkg-config to find the headers:
k5054@localhost:~/tmp$ g++ $(pkg-config --cflags dbus-1) hello.cpp
k5054@localhost:~/tmp$ ./a.out
Hello World
k5054@localhost:~/tmp$ This clearly finds the requested headers and compiles the program successfully. I'd recommend that you try this from the command line exactly as shown here. If you get a successful compile, you need to dig into your IDE and find out how to configure it correctly. If this doesn't work for you, then you've probably ed up your linux installation, and my best recommendation would be to back anything you want to keep, purge your drives, then reinstall. Before recovering your backed up files, make sure that the above simple program will compile. If not, you need to figure out why.
In over 30 years of working with Unix like systems, the only time I've copied headers under /usr/include, or /usr/local/include to a local project was when I've been trying to do something weird, like trying to compile a new package on an obsolete OS [think trying to get a new version of GCC to compile on RedHat 9 (circa 2003)] or vice versa, e.g getting gcc-2.95 to compile on RedHat Fedora 37. If you find yourself copying includes from the system include directories then IMHO you're making a mistake, and clearly don't understand the build process. That would be true if you find yourself doing this on a Windows system as well.
Don't forget that in order to link to the dbus libraries, you'll need to add pkg-config --libs dbus-1 somewhere so that the link phase knows where to find the needed libraries.
Knowing that the -I flag tells the compiler where to look for include files is simple, basic unix developer course 101 stuff. You shouldn't have any issues understanding that if you've spent more than a couple of weeks doing any Linux or Unix development. The only thing I can think is that you've become over dependent on your IDE and you're not understanding the basic Linux development ecosystem. It might be worth while to break out one or two of the functional parts of your project from the UI/IDE and get them to compile using nothing more sophisticated than a Makefile. If you can get that done, and your IDE keeps breaking the build, you'll probably be better equipped to dig into the IDE settings and figure out what needs to be altered to get it to work.
Good Luck
"A little song, a little dance, a little seltzer down your pants"
Chuckles the clown
|
|
|
|
|
Thanks for such exhaustive reply. Appreciate that very much. It does not answer why specific header out of many is "missing". I did change the reference to "/dbus.." - instead of being "at the end of thee #include chain" be "direct" , but with same result.
I suspect the cloning process is the issue.
I am going to build (clone) a separate project , maybe use a different example, from the github.
|
|
|
|
|
I still think you're doing something wrong. What github repository are you using? Maybe I'll give it a try and see if I get the same results ... In which case it means that the repository may have issues and the maintainers should be alerted.
"A little song, a little dance, a little seltzer down your pants"
Chuckles the clown
|
|
|
|
|
Myself I don't know what github would have to do with it.
When it compiles either the file is there or not. Or it is accessible or not.
How does Git impact unless git is causing one of those specific problems?
|
|
|
|
|
My suspicion is that at least one of the following is true:
A) the OP is not following the compilation instructions from the git repo
B) the OP has not added the prerequisites for the repo to compile
C) the repo does not list what resources are needed (e.g dev libraries, cmake, etc). Or that information is buried somewhere in the repo source files, and the OP has not stumbled upon it, yet.
The OP also has some odd notion that he can "fix" things by copying header files from somewhere in /usr/include to the local directory. My experience suggests that 99.99% of the time, this will not work, and is about the worst solution I could think of to get things to compile.
"A little song, a little dance, a little seltzer down your pants"
Chuckles the clown
|
|
|
|
|
I'm currently working on a lattice Boltzmann code (D3Q27) employing MPI for parallelization. I've implemented MPI 3D topology for communication, and my code snippet handles communication as follows, I also have the same structure for the communication between front-back and up-down.
void Simulation::Communicate(int iter) {
int tag_xp = 0;
int tag_xm = 1;
int tag_yp = 2;
int tag_ym = 3;
int tag_zp = 4;
int tag_zm = 5;
MPI_Status status;
if (SubDomain_.my_right_ != MPI_PROC_NULL) {
std::vector<double> send_data;
for (int k = 0; k < SubDomain_.my_Nz_; k++) {
for (int j = 0; j < SubDomain_.my_Ny_; j++) {
if (SubDomain_.lattice_[SubDomain_.my_Nx_ - 2][j][k] == nullptr) {
for (int dir = 0; dir < _nLatNodes; dir++) {
send_data.push_back(0.0);
}
}
else {
for (int dir = 0; dir < _nLatNodes; dir++) {
send_data.push_back(SubDomain_.lattice_[SubDomain_.my_Nx_ - 2][j][k]->m_distributions[dir]);
}
}
}
}
std::vector<double> recv_data(send_data.size());
MPI_Sendrecv(send_data.data(), send_data.size(), MPI_DOUBLE, SubDomain_.my_right_, tag_xp,
recv_data.data(), recv_data.size(), MPI_DOUBLE, SubDomain_.my_right_, tag_xm,
MPI_COMM_WORLD, &status);
int index = 0;
for (int k = 0; k < SubDomain_.my_Nz_; k++) {
for (int j = 0; j < SubDomain_.my_Ny_; j++) {
for (int dir = 0; dir < _nLatNodes; dir++) {
SubDomain_.lattice_[SubDomain_.my_Nx_ - 1][j][k]->m_distributions[dir] = recv_data[index];
index++;
}
}
}
}
if (SubDomain_.my_left_ != MPI_PROC_NULL) {
std::vector<double> send_data;
for (int k = 0; k < SubDomain_.my_Nz_; k++) {
for (int j = 0; j < SubDomain_.my_Ny_; j++) {
if (SubDomain_.lattice_[1][j][k] == nullptr) {
for (int dir = 0; dir < _nLatNodes; dir++) {
send_data.push_back(0.0);
}
}
else {
for (int dir = 0; dir < _nLatNodes; dir++) {
send_data.push_back(SubDomain_.lattice_[1][j][k]->m_distributions[dir]);
}
}
}
}
std::vector<double> recv_data(send_data.size());
MPI_Sendrecv(send_data.data(), send_data.size(), MPI_DOUBLE, SubDomain_.my_left_, tag_xm,
recv_data.data(), recv_data.size(), MPI_DOUBLE, SubDomain_.my_left_, tag_xp,
MPI_COMM_WORLD, &status);
int index = 0;
for (int k = 0; k < SubDomain_.my_Nz_; k++) {
for (int j = 0; j < SubDomain_.my_Ny_; j++) {
for (int dir = 0; dir < _nLatNodes; dir++) {
SubDomain_.lattice_[0][j][k]->m_distributions[dir] = recv_data[index];
index++;
}
}
}
}
}
While I can verify that communication occurs correctly by printing sent and received data, upon visualization, it appears that the data might not be transferring to neighboring processors as expected, despite not being zeroed out (as previously confirmed through printing). After each iteration, I visualize the velocity components obtained via the Lattice Boltzmann Method (LBM). My observation reveals that the fluid dynamics are solely resolved within the processor featuring the inlet boundary condition, while all other processors exhibit a velocity of zero. This suggests that data transfer to neighboring processors might not be occurring as expected.
I have a couple of concerns:
Could data corruption arise from blocking communication? Is diagonal communication necessary? My understanding is that if communication in the normal directions (x, y, and z) is established, diagonal communication implicitly occurs. Additionally, I'm uncertain about the order of communication. Do all communications happen simultaneously, or is it sequential (e.g., right and left, then front and back, then up and down)? If they're not simultaneous, would diagonal communication be required?
I also have a confusion in receiver processor id. for example
MPI_Sendrecv(send_data.data(), send_data.size(), MPI_DOUBLE, SubDomain_.my_right_, tag_xp, recv_data.data(), recv_data.size(), MPI_DOUBLE, SubDomain_.my_right_, tag_xm, MPI_COMM_WORLD, &status); should it be SubDomain_.myrank_, instead of SubDomain_.my_right_ in receive part?
I'd appreciate any insights to clarify these points of confusion. Thank you!
|
|
|
|
|
Use code tags when you post code.
The context of your questions is not clear.
There is theory and there is practice (implementation). To which do your questions refer?
Are you asking if your code is right? And only that?
Are you asking if your theory is right? And only that?
If the second then the code doesn't help.
If the first then you should provide some specifics about which part of the code you think has a problem.
If you are mixing the two then I would suggest that you rethink what it is that you actually need to ask.
I suspect also that at least for the theory you need to run on hardware that tests this. Not clear to me how your code insures that the hardware is even being used. That however might both be because you didn't use code tags and because I didn't look that closely at the code.
|
|
|
|
|
I have "include" (cloned) a full project from "github".
It is missing ONE header file, hence ,it won't compile.
I have found another resource which contains the missing file.
This resource appears to be a "stand alone" header
and it does not give much explanation how to use it.
I am asking for suggestion
how to "merge" these resources,
basically how to
change the working clone "dbus/files"
to
"stand alone " "dbus/files"
Simple
include both does not work
Here is my current setup
UNDER construction
<pre>
this contains the missing header BUT NO OTHER CODE !
INCLUDEPATH += "/home/nov25-1/Downloads/nobus-master/include/dbus-1.0/dbus"
# temp removed contains usable code, but missing ONE header file
INCLUDEPATH += "../../A_BT_LIBRARY/SimpleBluetooth/SimpleBLE-main/simplebluez/include/simplebluez/"
#INCLUDEPATH += "../../A_BT_LIBRARY/SimpleBluetooth/SimpleBLE-main/simplebluez/include/"
#INCLUDEPATH += "../../A_BT_LIBRARY/SimpleBluetooth/SimpleBLE-main/simplebluez/simpledbus/advanced/"
#INCLUDEPATH += "../../A_BT_LIBRARY/SimpleBluetooth/SimpleBLE-main/simpledbus/include/"
///usr/include/core/dbus/dbus.h
#INCLUDEPATH += "/usr/include/"
#INCLUDEPATH += "/usr/include/dbus-1.0/"
# links to first dbus.h "missing" file
#INCLUDEPATH += "/usr/lib64/dbus-1.0/include/"
#INCLUDEPATH += "/home/nov25-1/Downloads/nobus-master/include/dbus-1.0/dbus"
# INCLUDEPATH += "/mnt/A_BT_DEC10/BT__PROGRAMS/A_JAN11 _FEB26/A_BT_LIBRARY/CCC_SOURCE/BT_no_bus/nobus-master/include/dbus-1.0"
#//dding -I/usr/lib64/dbus-1.0/include/ in c
#include <dbus/dbus-arch-deps.h>
INCLUDEPATH += "../../A_BT_LIBRARY/SimpleBluetooth/SimpleBLE-main/simpledbus/include/"
INCLUDE_DIRECTORIES("../../A_BT_LIBRARY/SimpleBluetooth/SimpleBLE-main/simplebluez/include/simplebluez")
#INCLUDEPATH = c:/msdev/include d:/stl/include
PS.
If it is unclear what I am asking for
please ask for clarification.
|
|
|
|
|
You can add any header files to your project repository, or in another location using the INCLUDEPATH variable as you have shown. But I am not sure what you mean by "a "stand alone" header", so yes, your question is not clear. Maybe if you showed the relevant code plus any error messages, it will become clearer.
|
|
|
|
|
Salvatore Terress wrote: I have "include" (cloned) a full project from "github"
Presumably you mean a single repo.
Salvatore Terress wrote: how to "merge" these resources,
Repo A has the code.
Repo B has the include file.
Copy the file from B and put it into A.
You do nothing at all with B after that.
Modify whatever you need to in A so the include file, in A, is used correctly. Compile and test A.
|
|
|
|
|
That is what I thought would work...
I may have to change A to be read / write...
I'll let you know the outcome...
Thanks
|
|
|
|
|
|
which github ?
CI/CD = Continuous Impediment/Continuous Despair
|
|
|
|
|
A SimpleBluetooth - full code
B nodbus dbus header only
both have dbus as a "wrapper' folder.
I am busy trying to keep the separate but in my own directory stricture.
So I have not actually compare the real headers.
I won't be surprised if the foundation is "bluez
library.
There are too many "clones" of this undocumented source...
seems a waste of talent to keep reinventing " bluez"...
|
|
|
|
|
Hi guys, I'm trying to understand the mechanism behind the Paige-Tarjan algorithm. I searched a lot on the internet but I found only papers with analytical explanations, but I would lite to understand pratically how it works, with an example, an exercise or something else.
I already downloaded the bispy repository on git but I don't understand how it works pratically, which are the steps that lead me to say that this is the result
for an easy example, with this graph:
0 -> 1,2
1 -> 3,4
2 -> 5,6
3,4,5,6 -> null
I can't understand which are the steps that results in:
[(1, 2), (3, 4, 5, 6), (0,)]
I hope someone can explain me this. Thank you all.
|
|
|
|
|
link to the git ?
CI/CD = Continuous Impediment/Continuous Despair
|
|
|
|
|
|
Extracting the Points from a CRgn Object - C / C++ / MFC ...
|
|
|
|
|
|
I've an MFC app. When the mouse hovers over a spot, I want a small popup window to appear displaying helpful info. It goes away when the mouse moves etc. How is this done? Need some clues. Thanks.
|
|
|
|
|
It depends on what is in the spot that the mouse is hovering over. Take a look at sme of the following links: mfc tooltip - Google Search[^].
|
|
|
|
|
This is my current resource:
https://www.ibm.com/docs/en/zos/2.1.0?topic=line-using-redirection-symbols
unfortunately I am not sure WHERE the redirection belongs
in my system call parameters.
Here is my TEST code
QFile *resultFile;
system(" echo q | sudo -S hcitool cc --role=c 98:D3:31:F8:29:33 > resultFile");
system(" echo q | sudo -S hcitool info 98:D3:31:F8:39:33 > resultFile");
return;
and the TEST debug result
[sudo] password for nov25-1: Can't create connection: Input/output error
[sudo] password for nov25-1:
neither one provides data output to "resultFile".
Please note that the first "system" call attempts to "connect" and fails ,hence
would not have any data to redirect anyway. Expected with "no
connection " behavior.( Used to test compiler /linker. )
I am asking for help placing the ">resultFile" into system call.
|
|
|
|
|
I don't know what's the difference between the two commands. I don't know what hcitool does, but I don't think that matters.
What the command(s) do, is to pass the string "q" as stdin to sudo . If "q" is the user password, that's fine because sudo expects to read the user password. On my machine I tried:
echo xxxxxx | sudo -S ps -A > results and that works fine. I get the output of ps in the results file ("xxxxxx" is the user "password").
Now how useful or portable such an approach is, is another question.
- Do you plan to have user's password embedded in your code? What if you change your password? would you recompile the code or what?
- Wouldn't it be simpler to just accept that your code has to be run as root?
- Maybe you can set hcitool to be run with sudo without a password. Take a look at Sudoers Manual[^]:
Quote: PASSWD and NOPASSWD
By default, sudo requires that a user authenticate before running a command. This behavior can be modified via the NOPASSWD tag. Like a Runas_Spec, the NOPASSWD tag sets a default for the commands that follow it in the Cmnd_Spec_List. Conversely, the PASSWD tag can be used to reverse things. For example:
ray rushmore = NOPASSWD: /bin/kill, /bin/ls, /usr/bin/lprm
would allow the user ray to run /bin/kill, /bin/ls, and /usr/bin/lprm as root on the machine “rushmore” without authenticating himself. If we only want ray to be able to run /bin/kill without a password the entry would be:
ray rushmore = NOPASSWD: /bin/kill, PASSWD: /bin/ls, /usr/bin/lprm
Mircea
|
|
|
|
|