Problem with HAL::Get()

Login to reply to this topic.
Thu, 2007-10-11 15:42
Joined: 2007-08-14
Forum posts: 4

Hi,

Im new to symbina development.

Im trying to get the battery info thru HAL::Get() method

my code snippet is as follows

================================
HALData haldata;
TInt battStatus = 0;
HAL::Get(HALData::EPowerBatteryStatus,battStatus);
================================

The include block is

#include hal.h
#include hal_data.h
#include e32std.h

i linked against
LIBRARY hal.lib in my mmp

Im getting the following error at compilation
========================================================================================================================
2 Undefined symbol: 'int HAL::Get(enum HALData::TAttribute, int &) (?Get@HAL@@SAHW4TAttribute@HALData@@AAH@Z)' referenced from 'void CMultiViewsContainer3::Draw(class TRect const &) const (?Draw@CMultiViewsContainer3@@UBEXABVTRect@@@Z)' in multiviewscontainer3.cpp:47 multiviews line 0 October 11, 2007 5:52:25 PM 392
========================================================================================================================

Im trying this code in emulator with s60 2nd fp1.

also i tried TUid battStatus;
it is given like this in one of the wiki in forum.nokia http://wiki.forum.nokia.com/index.php/How_to_get_Battery_Status
But im getting the following error
========================================================================================================================
2 illegal implicit conversion from 'unsigned int' to 'int &' multiviewscontainer3.cpp multiviews/src line 47 October 11, 2007 6:19:01 PM 394
========================================================================================================================


Fri, 2007-10-12 14:51
Joined: 2004-11-29
Forum posts: 1156
Re: Problem with HAL::Get()

The link error is weird, the library to link against is indeed hal.lib.

You might have to re-import your mmp file so your build environment really adds the library.
You didn't say what environment you try to use.
Building from command line, you should just need to add it to the mmp though.

About the second error, just change TUint battstatus; to TInt battstatus; and it should work.

Sat, 2007-10-13 12:04
Joined: 2007-04-29
Forum posts: 51
Re: Problem with HAL::Get()

It must be TInt , not TUint

Mon, 2007-10-15 08:03
Joined: 2007-08-14
Forum posts: 4
Re: Problem with HAL::Get()


Infact i tried it as TInt and not TUInt.
Im using carbide.c++ v1.1. As u said i updated the mmp file. To my suprise, once i update it is deleting what i have added (LIBRARY) to .mmp
it is commented as follows

*& START_LINKAGE_INFORMATION &*/
// NOTE: Content in this section is auto-generated, any changes are overwritten in the next update process.

and the error still exists. Im unable to link.

  • Login to reply to this topic.