Menu

Linker Error using PathFileExists

2007-08-29
2012-09-26
  • Chris Davidson

    Chris Davidson - 2007-08-29

    I am trying to get a program to compile. I have a reference to Shlwapi.h. I have the following int varible set to the following:

    retval == PathFileExists("MyDoc.txt");

    When I have that in the code I get a "[Linker error] undefined reference to '_imp__PathFileExistsA@4'
    error. If I comment that out the program compiles fine. What I am aiming for is a program that will go out and see if a directory or file exists and delete it if it does. Any suggestions will be greatly appreciated.

     
    • Nobody/Anonymous

       
      • Nobody/Anonymous

        i am trying to run my program.But i get error message saying linker error
        i dont know what it wrong .Any body can help me because i am very new in C++ language?
        this program has something to do with classis.
        yoursincerly
        ss shandu
        from durban (South Africa)

         
        • Wayne Keen

          Wayne Keen - 2007-08-30

          Your question does not pertain directly to this thread. Do not tack a question onto
          an existing thread like this, start a new one.

          When you do, you need to relaalize that you gave us essnetially NO useful information
          for helping you, other than you are having a linker error. That is like calling up
          your doctor, telling him "I don't feel well", and expecting a diagnosis.

          So:

          Before starting your new thread, please take a moment and check out the thread in
          this very forum titled "PLEASE READ BEFORE POSTING A QUESTION" - in particular the
          section on "The Basic 3" - the information we need to figure out what is going
          on - without having to run up our "Psychic Friends Network" bill.

          Wayne

           
    • Nobody/Anonymous

      did you link with libshlwapi.a (shlwapi.dll)?

       
    • Chris Davidson

      Chris Davidson - 2007-08-29

      I suppose I did not. How would I go about doing that?

       
    • Nobody/Anonymous

      Project->Options->Parameters

      right column (Linker)

      add -lshlwapi in the textbox or use the button below to locate the mentioned lib in your dev-cpp/lib-folder

       
    • Wayne Keen

      Wayne Keen - 2007-08-29

      There is a section in the thread titled "Please Read Before Posting a Question" on the compile log, including headers, and linking libraries that can give you some background on the library linking process as well.

      Wayne

       
    • Chris Davidson

      Chris Davidson - 2007-08-29

      Got it. Thanks! I habe the code compiling and that function now is working perfectly. I am now working on deleting the files from the directort and the diectory itself. I can get the files to delete fine but I am stuck on how to get the directory to delete. I will check on the forum a bit but if anyone wants to give me a push in the right direction it would help.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.