error LNK2019: unresolved external symbol "long __stdca

N

naveenadevi

Hi,


I'm trying to use some power management features with windowsx xp
and I have visual studio .net 2003 installed.
As per documentation of ACPI, you can
use the power options by including the Powrprof.h file and use the
Powrprof.lib file in your project, which I did, but when I build, it
compiles fine but I get this Link error.. :

error LNK2019: unresolved external symbol "long __stdcall
CallNtPowerInformation(enum POWER_INFORMATION_LEVE,void*,usigned
long,void*,unsignedlong)"
(?CallNtPowerInformation@@YGJW4POWER_INFORMATION_LEVEL@@PAXK1K@Z)
referenced in
function _main
fatal error LNK1120: 1 unresolved externals


The code is as shown below :...
Any Ideas on what I'm missing here... please help...

Thanks,
Regards,
AS.
#include "stdafx.h"

#include <windows.h>
#include <stdio.h>
#include <lmaccess.h>

#include <powrprof.h>


int _tmain(int argc, _TCHAR* argv[])
{
SYSTEM_POWER_CAPABILITIES cap;

NTSTATUS status;
status = CallNtPowerInformation(
SystemPowerCapabilities,
NULL,
0,
&cap,
sizeof(cap));

return 0;
}
 
J

Jeff Partch [MVP]

naveenadevi said:
Hi,


I'm trying to use some power management features with windowsx xp
and I have visual studio .net 2003 installed.
As per documentation of ACPI, you can
use the power options by including the Powrprof.h file and use the
Powrprof.lib file in your project, which I did, but when I build, it
compiles fine but I get this Link error.. :

error LNK2019: unresolved external symbol "long __stdcall
CallNtPowerInformation(enum POWER_INFORMATION_LEVE,void*,usigned
long,void*,unsignedlong)"
(?CallNtPowerInformation@@YGJW4POWER_INFORMATION_LEVEL@@PAXK1K@Z)
referenced in
function _main
fatal error LNK1120: 1 unresolved externals


The code is as shown below :...
Any Ideas on what I'm missing here... please help...

I suspect that you need to link against Powrprof.lib.
 
G

Guest

I am having the same issue. Powrprof.lib is listed in my IDE to be linked.
Any other ideas?

Thanks.
Nate
 
G

Guest

Your problem is that you didn't put the 'extern "C" {}' around the #include<pawrprof.h>.
I had the same problem and that fixed it.

Good luck!
--Ed
Hi,and I have visual studio .net 2003 installed.
As per documentation of ACPI, you can
use the power options by including the Powrprof.h file and use the
Powrprof.lib file in your project, which I did, but when I build, it
compiles fine but I get this Link error.. :
error LNK2019: unresolved external symbol "long __stdcall
CallNtPowerInformation(enum POWER_INFORMATION_LEVE,void*,usigned
long,void*,unsignedlong)"
(?CallNtPowerInformation@@YGJW4POWER_INFORMATION_LEVEL@@PAXK1K@Z)
referenced in
function _main
fatal error LNK1120: 1 unresolved externalsAny Ideas on what I'm missing here... please help...
Regards,
AS.
#include "stdafx.h"
#include <windows.h>
#include said:
#include said:
int _tmain(int argc, _TCHAR* argv[])
{
SYSTEM_POWER_CAPABILITIES cap;
NTSTATUS status;
status = CallNtPowerInformation(
SystemPowerCapabilities,
NULL,
0,
&cap,
sizeof(cap));
return 0;
}

User submitted from AEWNET (http://www.aewnet.com/)
 
G

Guest

Hi,
U can use the LoadLibrary to load the Powrprof.lib and get a pointer to that function
with GetProcAddress function.
i have used it n its wrking fine.

Regards,
VK

Hi,


I'm trying to use some power management features with windowsx xp
and I have visual studio .net 2003 installed.
As per documentation of ACPI, you can
use the power options by including the Powrprof.h file and use the
Powrprof.lib file in your project, which I did, but when I build, it
compiles fine but I get this Link error.. :

error LNK2019: unresolved external symbol "long __stdcall
CallNtPowerInformation(enum POWER_INFORMATION_LEVE,void*,usigned
long,void*,unsignedlong)"
(?CallNtPowerInformation@@YGJW4POWER_INFORMATION_LEVEL@@PAXK1K@Z)
referenced in
function _main
fatal error LNK1120: 1 unresolved externals


The code is as shown below :...
Any Ideas on what I'm missing here... please help...

Thanks,
Regards,
AS.
#include "stdafx.h"

#include <windows.h>
#include <stdio.h>
#include <lmaccess.h>

#include <powrprof.h>


int _tmain(int argc, _TCHAR* argv[])
{
SYSTEM_POWER_CAPABILITIES cap;

NTSTATUS status;
status = CallNtPowerInformation(
SystemPowerCapabilities,
NULL,
0,
&cap,
sizeof(cap));

return 0;
}

User submitted from AEWNET (http://www.aewnet.com/)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top