Menu

Pdh.h Linking errors

2003-08-11
2012-09-26
  • Joseph Pugh

    Joseph Pugh - 2003-08-11

    I have been trying for a couple of days, off and on, to get a project to compile.  I have tried every possibility that I know of to get rid of the following linker errors.

    ntAgentCPU.o(.text+0x13a):ntAgentCPU.cpp: undefined reference to `PdhOpenQueryA@12'
    ntAgentCPU.o(.text+0x152):ntAgentCPU.cpp: undefined reference to `PdhAddCounterA@16'
    ntAgentCPU.o(.text+0x160):ntAgentCPU.cpp: undefined reference to `PdhCollectQueryData@4'
    ntAgentCPU.o(.text+0x181):ntAgentCPU.cpp: undefined reference to `PdhCollectQueryData@4'
    ntAgentCPU.o(.text+0x19c):ntAgentCPU.cpp: undefined reference to `PdhGetFormattedCounterValue@16'
    ntAgentCPU.o(.text+0x1fc):ntAgentCPU.cpp: undefined reference to `PdhCloseQuery@4'

    The rest of the compiler log looks like this:

    Compiler: Default compiler
    Building Makefile: "C:\Documents and Settings\jpugh1\Desktop\NTAgent_DevCPP\Makefile.win"
    Executing  make...
    make.exe -f "C:\Documents and Settings\jpugh1\Desktop\NTAgent_DevCPP\Makefile.win" all
    g++.exe ntAgentCPU.o ntAgentDisk.o ntAgentLog.o ntAgentMain.o ntAgentMem.o  -o "NTAgent_DevCPP.exe" -L"C:/Dev-Cpp/lib" -L"C:/Program Files/Microsoft SDK/Lib" "../../../../Program Files/Microsoft SDK/Lib/Pdh.Lib"

    I am using Dev-C++ 4.9.8.0

    If anyone one has a suggestion for getting this project to link correctly, I would greatly appreciate it.

    Thanx.

    Joe

     
    • Wayne Keen

      Wayne Keen - 2003-08-11

      I am ignornat of the library you are trying to link, other than the fact that you may have problems with its format

      one thing I do see is that you are not actually linking anything.  The format of the command for linking a library, named xyz, which will normally be contained in a file called libxyz.a (.lib is usually a Microsoft format) is:

      -lxyz

      where that is a small L.  Small L does the linking, big L just puts things in the search path.  It is not enough to have the libaray in question in the search path, you must link it.

      Wayne

       
    • Joseph Pugh

      Joseph Pugh - 2003-08-11

      Good point on the lower case 'l' verses 'L', i will make sure to check that. 

      But .a libraries are static libraries.  The library that I am trying to link to is the performance data helper library, which is a .dll.  I have checked the header file, and the code does not have any msvc++ specific keywords that mingw wouldn't understand.

      Just to make sure that I understand the procedure for linking in libraries.  I would do this in the project options dialog box correct.  I click the parameters tab, and in the linker box type something to the effect of -lpdh?

      or is the procedure different for windows dll's?

      I have used Dev-C++ since the 4.9.5 release, but this is the first time i have done a lot of programs using windows specific libraries.

      Thanks for the help Wayne,
      any further help would be greatly appreciated.

      Joe

       
    • Wayne Keen

      Wayne Keen - 2003-08-11

      Generally, lets use GLUT as an example, the headers and the libraries tell the compiler where to find and operate things that are in the dll.  The dll you do not directly do anything to access, but it must be in a standard place, like windows/system32, or the bin directory...

      Wayne

       
    • Joseph Pugh

      Joseph Pugh - 2003-08-11

      I see what you mean about the .a verses the .lib extensions.  Is the format different, and if so, is there a way to use these library files???

      Thanks
      Joe

       
    • Wayne Keen

      Wayne Keen - 2003-08-12

      I have not experience doing that, you would probably be better off doing a forum search and posting a question over on the bloodshed forum, this forum is really for Dev developers, the Bloodshed software forum is more active in this sort of question...

      Wayne

       

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.