About Store Forum Documentation Contact



Post Reply 
Editor/C++ Compile Order
Author Message
Rubeus Offline
Member

Post: #1
Editor/C++ Compile Order
I made a small scale test showing my issue:
Code object "1":
Code:
namespace test
{
   class A
   {
   friend void test.B.SetA( int b ); // <-- Works
   private:
      int x;
      void ZeroX(  ) { x = 0; }
   public:
      void SetX( int y ){ x = y; }
   }
}
Code object "2":
Code:
namespace test
{
   class B
   {
   friend void test.A.SetX( int y ); // <-- Errors
   private:
      int a;
      void ZeroA(  ) { a = 0; }
   public:
      void SetA( int b ){ a = b; }
   }
}
The friend line works from A to B, but not B to A. It seems to be an issue with the order in which the classes are compiled.
I actually 'solved' the issue by changing the "B" class name in my main code to be alphanumerically lower than my "A" class name. I thought I would share, in case anyone else was getting "use of undefined type" errors seemingly randomly.
(This post was last modified: 06-21-2014 03:10 PM by Rubeus.)
06-21-2014 03:09 PM
Find all posts by this user Quote this message in a reply
Post Reply