Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C++ noob

Status
Not open for further replies.

djwatts

Programmer
Nov 10, 2004
91
GB
Hi All,

This is the first time i have had to leave the comfort of visual basic and tackle a c++ project using VC++ .NET

I am pretty good with VB and the windows enviroment, but I'm getting a bit stuck with .h and .lib files

I'm trying to link my program to include the powrprof.h header file (that comes with the platform SDK)

I haven't been able to get it working, every time I try and compile I get hundreds of errors. I don't think it can find the .lib file

I have checked the directories in tools > options and the library directory is referenced properly.

Anyone got any ideas/experiance of using this module. After I get it to include properly do I need to initialise it as a class???

Thanks for any help
 
Post some code and error messages.

Please use [tt][code][/code][/tt] tags for posting code.

--
 
the only real code at the moment is

#include "powrprof.h"

have also tried

#include <powrprof.h>

that's as far as I have got at the moment. I also read something about VC++ not liking C headers so I have tried

Code:
#ifdef __cplusplus
extern "C" {
#endif
#include "PowrProf.h"
#ifdef __cplusplus
}
#endif

The output from the compilation is below.

Thanks for any help on this, I just can't seem to get the powrprof.h file to compile I figured it must be something to do with the .lib file or am i wrong?



Green.cpp
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(19) : error C2146: syntax error : missing ';' before identifier 'Revision'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(19) : error C2501: '_GLOBAL_MACHINE_POWER_POLICY::ULONG' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(19) : error C2501: '_GLOBAL_MACHINE_POWER_POLICY::Revision' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(20) : error C2146: syntax error : missing ';' before identifier 'LidOpenWakeAc'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(20) : error C2501: '_GLOBAL_MACHINE_POWER_POLICY::SYSTEM_POWER_STATE' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(20) : error C2501: '_GLOBAL_MACHINE_POWER_POLICY::LidOpenWakeAc' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(21) : error C2146: syntax error : missing ';' before identifier 'LidOpenWakeDc'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(21) : error C2501: '_GLOBAL_MACHINE_POWER_POLICY::SYSTEM_POWER_STATE' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(21) : error C2501: '_GLOBAL_MACHINE_POWER_POLICY::LidOpenWakeDc' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(22) : error C2146: syntax error : missing ';' before identifier 'BroadcastCapacityResolution'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(22) : error C2501: '_GLOBAL_MACHINE_POWER_POLICY::ULONG' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(22) : error C2501: '_GLOBAL_MACHINE_POWER_POLICY::BroadcastCapacityResolution' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(26) : error C2146: syntax error : missing ';' before identifier 'Revision'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(26) : error C2501: '_GLOBAL_USER_POWER_POLICY::ULONG' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(26) : error C2501: '_GLOBAL_USER_POWER_POLICY::Revision' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(27) : error C2146: syntax error : missing ';' before identifier 'PowerButtonAc'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(27) : error C2501: '_GLOBAL_USER_POWER_POLICY::pOWER_ACTION_POLICY' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(27) : error C2501: '_GLOBAL_USER_POWER_POLICY::powerButtonAc' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(28) : error C2146: syntax error : missing ';' before identifier 'PowerButtonDc'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(28) : error C2501: '_GLOBAL_USER_POWER_POLICY::pOWER_ACTION_POLICY' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(28) : error C2501: '_GLOBAL_USER_POWER_POLICY::powerButtonDc' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(29) : error C2146: syntax error : missing ';' before identifier 'SleepButtonAc'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(29) : error C2501: '_GLOBAL_USER_POWER_POLICY::pOWER_ACTION_POLICY' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(29) : error C2501: '_GLOBAL_USER_POWER_POLICY::SleepButtonAc' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(30) : error C2146: syntax error : missing ';' before identifier 'SleepButtonDc'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(30) : error C2501: '_GLOBAL_USER_POWER_POLICY::pOWER_ACTION_POLICY' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(30) : error C2501: '_GLOBAL_USER_POWER_POLICY::SleepButtonDc' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(31) : error C2146: syntax error : missing ';' before identifier 'LidCloseAc'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(31) : error C2501: '_GLOBAL_USER_POWER_POLICY::pOWER_ACTION_POLICY' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(31) : error C2501: '_GLOBAL_USER_POWER_POLICY::LidCloseAc' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(32) : error C2146: syntax error : missing ';' before identifier 'LidCloseDc'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(32) : error C2501: '_GLOBAL_USER_POWER_POLICY::pOWER_ACTION_POLICY' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(32) : error C2501: '_GLOBAL_USER_POWER_POLICY::LidCloseDc' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(33) : error C2146: syntax error : missing ';' before identifier 'DischargePolicy'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(33) : error C2501: '_GLOBAL_USER_POWER_POLICY::SYSTEM_POWER_LEVEL' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(33) : error C2065: 'NUM_DISCHARGE_POLICIES' : undeclared identifier
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(33) : error C2501: '_GLOBAL_USER_POWER_POLICY::DischargePolicy' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(34) : error C2146: syntax error : missing ';' before identifier 'GlobalFlags'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(34) : error C2501: '_GLOBAL_USER_POWER_POLICY::ULONG' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(34) : error C2501: '_GLOBAL_USER_POWER_POLICY::GlobalFlags' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(52) : error C2146: syntax error : missing ';' before identifier 'Revision'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(52) : error C2501: '_MACHINE_POWER_POLICY::ULONG' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(52) : error C2501: '_MACHINE_POWER_POLICY::Revision' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(55) : error C2146: syntax error : missing ';' before identifier 'MinSleepAc'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(55) : error C2501: '_MACHINE_POWER_POLICY::SYSTEM_POWER_STATE' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(55) : error C2501: '_MACHINE_POWER_POLICY::MinSleepAc' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(56) : error C2146: syntax error : missing ';' before identifier 'MinSleepDc'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(56) : error C2501: '_MACHINE_POWER_POLICY::SYSTEM_POWER_STATE' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(56) : error C2501: '_MACHINE_POWER_POLICY::MinSleepDc' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(57) : error C2146: syntax error : missing ';' before identifier 'ReducedLatencySleepAc'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(57) : error C2501: '_MACHINE_POWER_POLICY::SYSTEM_POWER_STATE' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(57) : error C2501: '_MACHINE_POWER_POLICY::ReducedLatencySleepAc' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(58) : error C2146: syntax error : missing ';' before identifier 'ReducedLatencySleepDc'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(58) : error C2501: '_MACHINE_POWER_POLICY::SYSTEM_POWER_STATE' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(58) : error C2501: '_MACHINE_POWER_POLICY::ReducedLatencySleepDc' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(61) : error C2146: syntax error : missing ';' before identifier 'DozeTimeoutAc'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(61) : error C2501: '_MACHINE_POWER_POLICY::ULONG' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(61) : error C2501: '_MACHINE_POWER_POLICY::DozeTimeoutAc' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(62) : error C2146: syntax error : missing ';' before identifier 'DozeTimeoutDc'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(62) : error C2501: '_MACHINE_POWER_POLICY::ULONG' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(62) : error C2501: '_MACHINE_POWER_POLICY::DozeTimeoutDc' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(63) : error C2146: syntax error : missing ';' before identifier 'DozeS4TimeoutAc'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(63) : error C2501: '_MACHINE_POWER_POLICY::ULONG' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(63) : error C2501: '_MACHINE_POWER_POLICY::DozeS4TimeoutAc' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(64) : error C2146: syntax error : missing ';' before identifier 'DozeS4TimeoutDc'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(64) : error C2501: '_MACHINE_POWER_POLICY::ULONG' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(64) : error C2501: '_MACHINE_POWER_POLICY::DozeS4TimeoutDc' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(67) : error C2146: syntax error : missing ';' before identifier 'MinThrottleAc'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(67) : error C2501: '_MACHINE_POWER_POLICY::UCHAR' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(67) : error C2501: '_MACHINE_POWER_POLICY::MinThrottleAc' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(68) : error C2146: syntax error : missing ';' before identifier 'MinThrottleDc'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(68) : error C2501: '_MACHINE_POWER_POLICY::UCHAR' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(68) : error C2501: '_MACHINE_POWER_POLICY::MinThrottleDc' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(69) : error C2146: syntax error : missing ';' before identifier 'pad1'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(69) : error C2501: '_MACHINE_POWER_POLICY::UCHAR' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(69) : error C2501: '_MACHINE_POWER_POLICY::pad1' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(70) : error C2146: syntax error : missing ';' before identifier 'OverThrottledAc'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(70) : error C2501: '_MACHINE_POWER_POLICY::pOWER_ACTION_POLICY' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(70) : error C2501: '_MACHINE_POWER_POLICY::OverThrottledAc' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(71) : error C2146: syntax error : missing ';' before identifier 'OverThrottledDc'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(71) : error C2501: '_MACHINE_POWER_POLICY::pOWER_ACTION_POLICY' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(71) : error C2501: '_MACHINE_POWER_POLICY::OverThrottledDc' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(76) : error C2146: syntax error : missing ';' before identifier 'Revision'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(76) : error C2501: '_MACHINE_PROCESSOR_POWER_POLICY::ULONG' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(76) : error C2501: '_MACHINE_PROCESSOR_POWER_POLICY::Revision' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(78) : error C2146: syntax error : missing ';' before identifier 'ProcessorPolicyAc'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(78) : error C2501: '_MACHINE_PROCESSOR_POWER_POLICY::pROCESSOR_POWER_POLICY' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(78) : error C2501: '_MACHINE_PROCESSOR_POWER_POLICY::processorPolicyAc' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(79) : error C2146: syntax error : missing ';' before identifier 'ProcessorPolicyDc'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(79) : error C2501: '_MACHINE_PROCESSOR_POWER_POLICY::pROCESSOR_POWER_POLICY' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(79) : error C2501: '_MACHINE_PROCESSOR_POWER_POLICY::processorPolicyDc' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(84) : error C2146: syntax error : missing ';' before identifier 'Revision'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(84) : error C2501: '_USER_POWER_POLICY::ULONG' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(84) : error C2501: '_USER_POWER_POLICY::Revision' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(88) : error C2146: syntax error : missing ';' before identifier 'IdleAc'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(88) : error C2501: '_USER_POWER_POLICY::pOWER_ACTION_POLICY' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(88) : error C2501: '_USER_POWER_POLICY::IdleAc' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(89) : error C2146: syntax error : missing ';' before identifier 'IdleDc'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(89) : error C2501: '_USER_POWER_POLICY::pOWER_ACTION_POLICY' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(89) : error C2501: '_USER_POWER_POLICY::IdleDc' : missing storage-class or type specifiers
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(90) : error C2146: syntax error : missing ';' before identifier 'IdleTimeoutAc'
e:\Program Files\Vc7\PlatformSDK\Include\powrprof.h(90) : fatal error C1003: error count exceeds 100; stopping compilation

 
> I also read something about VC++ not liking C headers
If the headers are well written, they should have that notation already inside them for including in C or C++ programs.

It seems more likely that you're missing pre-requisite files.
A good idea might be to
#include <windows.h>



--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top