c++compiler-errorscorbaidlomniorb

Including a class.h file in a *.idl file gives errors


I have some simple Interface in Corba:

#ifndef __INTERFFACE_IDL__
#define __INTERFFACE_IDL__

import User.h;

interface Interfface {  void fun(in User u); };

#endif

And i also have simple C++ class User.h with private fields: firstName, lastName, age and getters and setters. I use omniORB, and try translate my interface to C++ file :


    omniidl -bcxx interface.idl

but it gives me those errors:

omniidl -bcxx interface.idl
interface.idl:4: Syntax error in definition
interface.idl:4: Syntax error in abstract valuetype
interface.idl:8: Error in look-up of 'User': 'User' not found
omniidl: 3 errors.

User.h is in the same folder that interface.idl is. What's wrong?

This code:

#ifndef __INTERFFACE_IDL__
#define __INTERFFACE_IDL__

**import test/User.h;**

interface Interfface {  void fun(in User u); };

#endif

gives same errors...

EDIT:

my User.h file:

#include <string>
using std::string;

class User
{
    private :
            string firstName;
            string lastName;
            int age;
    public :
            string getFirstName();
            string getLastName();
            int getAge();
            void setFirstName(string);
            void setLastName(string);
            void setAge(int);
};

Solution

  • import is not valid IDL. Perhaps you meant #include? But your User.h file is in C++. It needs to be in IDL.