Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Trouble accessing interfaces of my include files(Accessing an include from an include)
Trouble accessing interfaces of my include files [message #733906] Wed, 05 October 2011 22:32 Go to next message
Josiah  is currently offline Josiah Friend
Messages: 7
Registered: October 2011
Junior Member
I'm now having a strange problem:

I am defining my interface for a dynamic library I'm building. It looks like it will be fairly large, so I'm splitting the interface up into several headers.

I have the main header, which I'll call "Main.h", and then several helper headers that I want to include in Main.h, which I'll call "Helper1.h" and "Helper2.h"

So, I include Helper1.h and Helper2.h in my Main.h file, but I'm still getting errors saying the enums and classes from those files cannot be found.

heres a code example of what I have:

Helper1.h
#ifndef HELPER1_H_
#def HELPER1_H_

namespace Main {
	enum Helper1Enum {
		Element1 = 1,
		Element2
	};

        virtual class IHelper1 {
                virtual ~IHelper1Class();
                virtual int SomeMethod() = 0;
        };
}

#endif


Helper2.h
#ifndef HELPER1_H_
#def HELPER1_H_

namespace Main {
	enum Helper2Enum {
		Element1 = 1,
		Element2
	};

        virtual class IHelper2 {
                virtual ~IHelper1Class();
                virtual int SomeMethod() = 0;
        };
}

#endif


Main.h
#ifndef MAIN_H_
#def MAIN_H_

#include "Helper1.h"
#include "Helper2.h"

using namespace Main;

namespace Main {
        virtual class IHelper2 {
                virtual ~IHelper1Class();

                virtual IHelper1 FirstMethod(Helper1Enum param) = 0;
                virtual IHelper2 SecondMethod(Helper2Enum param) = 0;
        };
}

#endif



So this code gives me the error output:
Type 'Helper1Enum' could not be resolved
Type 'Helper2Enum' could not be resolved
Type 'IHelper1' could not be resolved
Type "IHelper2' could not be resolved

** Edit **
Forgot to mention, I'm using Eclipse IDE with the gcc C++ 4.5.2 compiler and gdb 7.2 on Ubuntu 11.04 as a Virtualbox guest on a Windows 7 host.

[Updated on: Wed, 05 October 2011 22:35]

Report message to a moderator

Re: Trouble accessing interfaces of my include files [message #734081 is a reply to message #733906] Thu, 06 October 2011 15:49 Go to previous message
Josiah  is currently offline Josiah Friend
Messages: 7
Registered: October 2011
Junior Member
This must be some sort of funny bug with the CDT or something in generating the makefile. I went into Main.h and changed
#include "Helper1.h"
to
#include "./Helper1.h"
and then the library magically compiled. I have since changed the line back to
#include "Helper1.h"
and cleaned and rebuilt the library and still no more errors.

I'm open to any ideas for why this might have solved the problem. I'd like the avoid this problem in the future.
Previous Topic:Trying to learn Eclipse C++ with CDT
Next Topic:link error 1104
Goto Forum:
  


Current Time: Fri Apr 19 05:49:36 GMT 2024

Powered by FUDForum. Page generated in 0.01839 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top