Error in program ?

Discussions related to using VirtualBox on Linux hosts.
Post Reply
vazzdoin
Posts: 15
Joined: 2. Feb 2009, 05:55

Error in program ?

Post by vazzdoin »

I am Facinf the following errors when i use the header files of VBoxManage.cpp in the tstVBoxAPILinux.cpp

/usr/include/libio.h:475: error: `__gnuc_va_list' has not been declared
/usr/include/libio.h:477: error: `__gnuc_va_list' has not been declared
In file included from tstVBoxAPILinux.cpp:14:
/usr/include/stdio.h:77: error: `__gnuc_va_list' does not name a type
In file included from tstVBoxAPILinux.cpp:14:
/usr/include/stdio.h:339: error: `__gnuc_va_list' has not been declared
/usr/include/stdio.h:344: error: `__gnuc_va_list' has not been declared
/usr/include/stdio.h:347: error: `__gnuc_va_list' has not been declared
/usr/include/stdio.h:358: error: `__gnuc_va_list' has not been declared
/usr/include/stdio.h:367: error: `__gnuc_va_list' has not been declared
/usr/include/stdio.h:383: error: `__gnuc_va_list' has not been declared
/usr/include/stdio.h:414: error: `__gnuc_va_list' has not been declared
/usr/include/stdio.h:421: error: `__gnuc_va_list' has not been declared
/usr/include/stdio.h:426: error: `__gnuc_va_list' has not been declared
In file included from tstVBoxAPILinux.cpp:14:
/usr/include/stdio.h:800: error: `__gnuc_va_list' has not been declared
In file included from ../../../../../../../../include/iprt/time.h:33,
from /usr/include/sys/types.h:133,
from /usr/include/stdlib.h:433,
from tstVBoxAPILinux.cpp:15:
../include/iprt/cdefs.h:149:3: #error "You must defined which context the compiled code should run in; IN_RING3, IN_RING0 or IN_GC"
In file included from ../../../../../../../../include/iprt/time.h:34,
from /usr/include/sys/types.h:133,
from /usr/include/stdlib.h:433,
from tstVBoxAPILinux.cpp:15:
../include/iprt/types.h:159: error: `uint64_t' does not name a type
../include/iprt/types.h:160: error: `uint64_t' does not name a type
../include/iprt/types.h:173: error: `uint64_t' does not name a type
../include/iprt/types.h:174: error: `int64_t' does not name a type
../include/iprt/types.h:185: error: `uint16_t' does not name a type
../include/iprt/types.h:188: error: `uint16_t' does not name a type
../include/iprt/types.h:190: error: `uint8_t' does not name a type
../include/iprt/types.h:194: error: `uint16_t' does not name a type




There are more errors with the same type with other Header files . It's not recognising the data types declared in the various Header files included in .h files.

can some one tell me where's the problem..?
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post by Sasquatch »

Which version do you run (OSE, PUEL)? Do you run a different kernel, like KVM or Xen? Those kernel builds are not suited for VB, because they already provide virtualisation and you can't run two at the same time.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
vazzdoin
Posts: 15
Joined: 2. Feb 2009, 05:55

Post by vazzdoin »

No m not running separate kernal... I dont know abt the version. M working on i386 RHEL.
stefan.becker
Volunteer
Posts: 7639
Joined: 7. Jun 2007, 21:53

Post by stefan.becker »

Sorry, so is no help possible.

We dont know anything about ist, too. This is not a quiz show.

Provide infos (exact approach / description what you done, version, etc.).
vazzdoin
Posts: 15
Joined: 2. Feb 2009, 05:55

Post by vazzdoin »

I searched over it and now i found that i am working on the Open source edition(OSE) version. Now,can nyone tell me where's the problem in my code.
stefan.becker
Volunteer
Posts: 7639
Joined: 7. Jun 2007, 21:53

Post by stefan.becker »

Which code? Details or forget it.
vazzdoin
Posts: 15
Joined: 2. Feb 2009, 05:55

Post by vazzdoin »

Following is the function code which m trying to run.

Code: Select all

static nsresult showInfo (nsCOMPtr <IVirtualBox> virtualBox, nsCOMPtr<IMachine> machine,
                           nsCOMPtr <IConsole> console = nsCOMPtr <IConsole> (),
                           VMINFO_DETAILS details = VMINFO_NONE)
{
    nsresult rc;
    nsCOMPtr<IMachine> machine;

    nsID uuid (argv[0]);
    if (!uuid.isEmpty())
   /* {
        CHECK_ERROR (virtualBox, GetMachine (uuid, machine.asOutParam()));
    }
    else*/
    {
        CHECK_ERROR (virtualBox, FindMachine (Bstr(argv[0]), machine.asOutParam()));
        if (NS_SUCCEEDED (rc))
            machine->COMGETTER(Id) (uuid.asOutParam());
    }
    if (NS_FAILED (rc))
        return 1;

   
    VMINFO_DETAILS details = VMINFO_NONE;
    bool fDetails = false;
    bool fStatistics = false;
    bool fMachinereadable = false;
    for (int i=1;i<argc;i++)
    {
        if (!strcmp(argv[i], "-details"))
            fDetails = true;
        else
        if (!strcmp(argv[i], "-statistics"))
            fStatistics = true;
        if (!strcmp(argv[1], "-machinereadable"))
            fMachinereadable = true;
    }
    if (fMachinereadable)
        details = VMINFO_MACHINEREADABLE;
    else
    if (fDetails && fStatistics)
        details = VMINFO_FULL;
    else
    if (fDetails)
        details = VMINFO_STANDARD;
    else
    if (fStatistics)
        details = VMINFO_STATISTICS;

    nsCOMPtr <IConsole> console;
    nsCOMPtr <ISession> session;
        rc = virtualBox->OpenExistingSession (session, uuid);
    if (NS_SUCCEEDED(rc))
        
        rc = session->COMGETTER(machine)(machine.asOutParam());
    if (NS_SUCCEEDED(rc))
        
        rc = session->COMGETTER(console)(console.asOutParam());

    rc = showInfo (virtualBox, machine, console, details);


    if (console)
        session->Close();

    return NS_SUCCEEDED (rc) ? 0 : 1;
}
But its not recogniising the datatypes of .h files like types.h , time.h etc.
if i exclude these header files from my programm then its giving the following errors:

Code: Select all

[root@localhost samples]# make
g++ -c -DRT_OS_LINUX -g -fshort-wchar -I../include -I../include/nsprpub -I../include/string -I../include/xpcom -I../include/ipcd -DVBOX_WITH_XPCOM_NAMESPACE_CLEANUP -o tstVBoxAPILinux.o tstVBoxAPILinux.cpp
tstVBoxAPILinux.cpp: In function `nsresult showInfo(nsCOMPtr<IVirtualBox>, nsCOMPtr<IMachine>, nsCOMPtr<IConsole>, VMINFO_DETAILS)':
tstVBoxAPILinux.cpp:108: error: declaration of 'nsCOMPtr<IMachine> machine' shadows a parameter
tstVBoxAPILinux.cpp:110: error: `argv' undeclared (first use this function)
tstVBoxAPILinux.cpp:110: error: (Each undeclared identifier is reported only once for each function it appears in.)
tstVBoxAPILinux.cpp:111: error: 'struct nsID' has no member named 'isEmpty'
tstVBoxAPILinux.cpp:117: error: `Bstr' undeclared (first use this function)
tstVBoxAPILinux.cpp:117: error: 'class nsCOMPtr<IMachine>' has no member named 'asOutParam'
tstVBoxAPILinux.cpp:117: error: `FindMachine' undeclared (first use this function)
tstVBoxAPILinux.cpp:117: error: `CHECK_ERROR' undeclared (first use this function)
tstVBoxAPILinux.cpp:119: error: 'class nsDerivedSafe<IMachine>' has no member named 'COMGETTER'
tstVBoxAPILinux.cpp:119: error: `Id' undeclared (first use this function)
tstVBoxAPILinux.cpp:119: error: 'struct nsID' has no member named 'asOutParam'
tstVBoxAPILinux.cpp:125: error: declaration of 'VMINFO_DETAILS details' shadows a parameter
tstVBoxAPILinux.cpp:129: error: `argc' undeclared (first use this function)
tstVBoxAPILinux.cpp:151: error: declaration of 'nsCOMPtr<IConsole> console' shadows a parameter
tstVBoxAPILinux.cpp:156: error: 'class nsDerivedSafe<ISession>' has no member named 'COMGETTER'
tstVBoxAPILinux.cpp:156: error: 'class nsCOMPtr<IMachine>' has no member named 'asOutParam'
tstVBoxAPILinux.cpp:159: error: 'class nsDerivedSafe<ISession>' has no member named 'COMGETTER'
tstVBoxAPILinux.cpp:159: error: 'class nsCOMPtr<IConsole>' has no member named 'asOutParam'
tstVBoxAPILinux.cpp: In function `int main(int, char**)':
tstVBoxAPILinux.cpp:97: error: too few arguments to function `nsresult showInfo(nsCOMPtr<IVirtualBox>, nsCOMPtr<IMachine>, nsCOMPtr<IConsole>, VMINFO_DETAILS)'
tstVBoxAPILinux.cpp:533: error: at this point in file
make: *** [tstVBoxAPILinux.o] Error 1
Modedit: When posting code, it's useful to use the code blocks ;).
Post Reply