Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to recover missing file ?

How to recover missing file ?

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++tutorialquestion
11 Posts 4 Posters 89 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Lost User

    I have a cloned "wrapper' header file containing other headers. The compiler fails to find one of them. But file manager has no problem opening it. I checked the contents of the file and it looks similar to other headers. \

    #ifndef DBUS_H
    #define DBUS_H

    #define DBUS_INSIDE_DBUS_H 1

    #include #include #include #include #include #include #include #include #include #include #include #include #include compiler l,fails to "find" this file ONLY
    #include #include #include #undef DBUS_INSIDE_DBUS_H

    here is FULL compiler error

    /usr/include/dbus-1.0/dbus/dbus.h:42: error: 'dbus/dbus-syntax.h' file not found
    In file included from BT_CONNECT.cpp:14:
    In file included from ../../A_BT_LIBRARY/SimpleBluetooth/SimpleBLE-main/simplebluez/include/simplebluez/Adapter.h:2:
    In file included from ./../../A_BT_LIBRARY/SimpleBluetooth/SimpleBLE-main/simpledbus/include/simpledbus/advanced/Proxy.h:3:
    In file included from ../../A_BT_LIBRARY/SimpleBluetooth/SimpleBLE-main/simpledbus/include/simpledbus/advanced/Interface.h:3:
    In file included from ../../A_BT_LIBRARY/SimpleBluetooth/SimpleBLE-main/simpledbus/include/simpledbus/base/Connection.h:18:
    /usr/include/dbus-1.0/dbus/dbus.h:42:10: fatal error: 'dbus/dbus-syntax.h' file not found
    #include
    ^~~~~~~~~~~~~~~~~~~~

    I am asking for suggestion(s) how to convince the compiler that the file does exists. Or what could be wrong with the header source, and way to temporary bypass it so ,I can compile the code. PS If it helps I could post the header source here...

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #2

    Why should "we" convince the compiler of somthing only "you" can see (or not see)? The existence of said file is "hearsay".

    "Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I

    1 Reply Last reply
    0
    • L Lost User

      I have a cloned "wrapper' header file containing other headers. The compiler fails to find one of them. But file manager has no problem opening it. I checked the contents of the file and it looks similar to other headers. \

      #ifndef DBUS_H
      #define DBUS_H

      #define DBUS_INSIDE_DBUS_H 1

      #include #include #include #include #include #include #include #include #include #include #include #include #include compiler l,fails to "find" this file ONLY
      #include #include #include #undef DBUS_INSIDE_DBUS_H

      here is FULL compiler error

      /usr/include/dbus-1.0/dbus/dbus.h:42: error: 'dbus/dbus-syntax.h' file not found
      In file included from BT_CONNECT.cpp:14:
      In file included from ../../A_BT_LIBRARY/SimpleBluetooth/SimpleBLE-main/simplebluez/include/simplebluez/Adapter.h:2:
      In file included from ./../../A_BT_LIBRARY/SimpleBluetooth/SimpleBLE-main/simpledbus/include/simpledbus/advanced/Proxy.h:3:
      In file included from ../../A_BT_LIBRARY/SimpleBluetooth/SimpleBLE-main/simpledbus/include/simpledbus/advanced/Interface.h:3:
      In file included from ../../A_BT_LIBRARY/SimpleBluetooth/SimpleBLE-main/simpledbus/include/simpledbus/base/Connection.h:18:
      /usr/include/dbus-1.0/dbus/dbus.h:42:10: fatal error: 'dbus/dbus-syntax.h' file not found
      #include
      ^~~~~~~~~~~~~~~~~~~~

      I am asking for suggestion(s) how to convince the compiler that the file does exists. Or what could be wrong with the header source, and way to temporary bypass it so ,I can compile the code. PS If it helps I could post the header source here...

      M Offline
      M Offline
      Maximilien
      wrote on last edited by
      #3

      Have you updated the "additional include directories" in the project settings ?

      CI/CD = Continuous Impediment/Continuous Despair

      L 1 Reply Last reply
      0
      • L Lost User

        I have a cloned "wrapper' header file containing other headers. The compiler fails to find one of them. But file manager has no problem opening it. I checked the contents of the file and it looks similar to other headers. \

        #ifndef DBUS_H
        #define DBUS_H

        #define DBUS_INSIDE_DBUS_H 1

        #include #include #include #include #include #include #include #include #include #include #include #include #include compiler l,fails to "find" this file ONLY
        #include #include #include #undef DBUS_INSIDE_DBUS_H

        here is FULL compiler error

        /usr/include/dbus-1.0/dbus/dbus.h:42: error: 'dbus/dbus-syntax.h' file not found
        In file included from BT_CONNECT.cpp:14:
        In file included from ../../A_BT_LIBRARY/SimpleBluetooth/SimpleBLE-main/simplebluez/include/simplebluez/Adapter.h:2:
        In file included from ./../../A_BT_LIBRARY/SimpleBluetooth/SimpleBLE-main/simpledbus/include/simpledbus/advanced/Proxy.h:3:
        In file included from ../../A_BT_LIBRARY/SimpleBluetooth/SimpleBLE-main/simpledbus/include/simpledbus/advanced/Interface.h:3:
        In file included from ../../A_BT_LIBRARY/SimpleBluetooth/SimpleBLE-main/simpledbus/include/simpledbus/base/Connection.h:18:
        /usr/include/dbus-1.0/dbus/dbus.h:42:10: fatal error: 'dbus/dbus-syntax.h' file not found
        #include
        ^~~~~~~~~~~~~~~~~~~~

        I am asking for suggestion(s) how to convince the compiler that the file does exists. Or what could be wrong with the header source, and way to temporary bypass it so ,I can compile the code. PS If it helps I could post the header source here...

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #4

        Where exactly did you find that file?

        1 Reply Last reply
        0
        • M Maximilien

          Have you updated the "additional include directories" in the project settings ?

          CI/CD = Continuous Impediment/Continuous Despair

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #5

          That is not (very) logical. There is series of "includes" from same resource and they are "found". I can open the file, so what is stopping the compiler to "find" it?

          1 Reply Last reply
          0
          • L Lost User

            I have a cloned "wrapper' header file containing other headers. The compiler fails to find one of them. But file manager has no problem opening it. I checked the contents of the file and it looks similar to other headers. \

            #ifndef DBUS_H
            #define DBUS_H

            #define DBUS_INSIDE_DBUS_H 1

            #include #include #include #include #include #include #include #include #include #include #include #include #include compiler l,fails to "find" this file ONLY
            #include #include #include #undef DBUS_INSIDE_DBUS_H

            here is FULL compiler error

            /usr/include/dbus-1.0/dbus/dbus.h:42: error: 'dbus/dbus-syntax.h' file not found
            In file included from BT_CONNECT.cpp:14:
            In file included from ../../A_BT_LIBRARY/SimpleBluetooth/SimpleBLE-main/simplebluez/include/simplebluez/Adapter.h:2:
            In file included from ./../../A_BT_LIBRARY/SimpleBluetooth/SimpleBLE-main/simpledbus/include/simpledbus/advanced/Proxy.h:3:
            In file included from ../../A_BT_LIBRARY/SimpleBluetooth/SimpleBLE-main/simpledbus/include/simpledbus/advanced/Interface.h:3:
            In file included from ../../A_BT_LIBRARY/SimpleBluetooth/SimpleBLE-main/simpledbus/include/simpledbus/base/Connection.h:18:
            /usr/include/dbus-1.0/dbus/dbus.h:42:10: fatal error: 'dbus/dbus-syntax.h' file not found
            #include
            ^~~~~~~~~~~~~~~~~~~~

            I am asking for suggestion(s) how to convince the compiler that the file does exists. Or what could be wrong with the header source, and way to temporary bypass it so ,I can compile the code. PS If it helps I could post the header source here...

            J Offline
            J Offline
            jschell
            wrote on last edited by
            #6

            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.

            1 Reply Last reply
            0
            • L Lost User

              I have a cloned "wrapper' header file containing other headers. The compiler fails to find one of them. But file manager has no problem opening it. I checked the contents of the file and it looks similar to other headers. \

              #ifndef DBUS_H
              #define DBUS_H

              #define DBUS_INSIDE_DBUS_H 1

              #include #include #include #include #include #include #include #include #include #include #include #include #include compiler l,fails to "find" this file ONLY
              #include #include #include #undef DBUS_INSIDE_DBUS_H

              here is FULL compiler error

              /usr/include/dbus-1.0/dbus/dbus.h:42: error: 'dbus/dbus-syntax.h' file not found
              In file included from BT_CONNECT.cpp:14:
              In file included from ../../A_BT_LIBRARY/SimpleBluetooth/SimpleBLE-main/simplebluez/include/simplebluez/Adapter.h:2:
              In file included from ./../../A_BT_LIBRARY/SimpleBluetooth/SimpleBLE-main/simpledbus/include/simpledbus/advanced/Proxy.h:3:
              In file included from ../../A_BT_LIBRARY/SimpleBluetooth/SimpleBLE-main/simpledbus/include/simpledbus/advanced/Interface.h:3:
              In file included from ../../A_BT_LIBRARY/SimpleBluetooth/SimpleBLE-main/simpledbus/include/simpledbus/base/Connection.h:18:
              /usr/include/dbus-1.0/dbus/dbus.h:42:10: fatal error: 'dbus/dbus-syntax.h' file not found
              #include
              ^~~~~~~~~~~~~~~~~~~~

              I am asking for suggestion(s) how to convince the compiler that the file does exists. Or what could be wrong with the header source, and way to temporary bypass it so ,I can compile the code. PS If it helps I could post the header source here...

              K Offline
              K Offline
              k5054
              wrote on last edited by
              #7

              !!! pkg-config is your friend !!! Here's a very simple program that #includes <dbus/dbus.h>

              #include #include 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
              | ^~~~~~~~~~~~~
              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 :elephant: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

              L 1 Reply Last reply
              0
              • K k5054

                !!! pkg-config is your friend !!! Here's a very simple program that #includes <dbus/dbus.h>

                #include #include 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
                | ^~~~~~~~~~~~~
                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 :elephant: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

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #8

                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.

                K 1 Reply Last reply
                0
                • L Lost User

                  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.

                  K Offline
                  K Offline
                  k5054
                  wrote on last edited by
                  #9

                  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

                  J 1 Reply Last reply
                  0
                  • K k5054

                    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

                    J Offline
                    J Offline
                    jschell
                    wrote on last edited by
                    #10

                    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?

                    K 1 Reply Last reply
                    0
                    • J jschell

                      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?

                      K Offline
                      K Offline
                      k5054
                      wrote on last edited by
                      #11

                      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

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups