Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

JoshG

Unresolved External, what external?

This topic is 6108 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I have built a class that looks like this:
  
class Registrar{
  public:
    Registrar();
    ~Registrar();
 
    static void Register(Function*);
    
  protected:
    static BTree *Functions;
};
  
The class itself works, all the functions are error free. However, when the code is compiled and then linked, There is a Linker error saying "Unresolved External ''Registrar::Functions''" I don''t understand why this is, because Functions is a variable (a binary Tree) whose class is defined above this implementation. all it''s functions work, and I have used that code before. Can anyone help me? --Josh

Share this post


Link to post
Share on other sites
Advertisement
ah, so I need that line also,
Yes, It works now, Many thanks!

EXCELLENT
Many, Many thanks

I mentioned something earlier about Access Violations, But I've figured that out now, after re-reading the article posted here.
Many thanks!

--Josh

Edited by - JoshG on December 30, 2001 6:40:43 PM

Edited by - JoshG on December 30, 2001 6:43:44 PM

Share this post


Link to post
Share on other sites
I can`t think of any reason that Functions being static would cause access violations. The only thing that imediately springs to mind is that you have a static pointer to a BTree. If you don`t create a BTree at some point and put its address in Functions then you`ll be in trouble

Share this post


Link to post
Share on other sites
This is beside the point, but you might want to avoid calling a binary tree a BTree. A B-Tree is a general multiway(not binary) tree.

Fantastic doctrines (like Christianity or Islam or Marxism or Microsoft-bashing) require unanimity of belief. One dissenter casts doubt on the creed of millions. Thus the fear and hate; thus the torture chamber, the iron stake, the gallows, the labor camp, the psychiatric ward - Edward Abbey

Share this post


Link to post
Share on other sites
quote:
Original post by JoshG
Hello,

I have built a class that looks like this:


      
class Registrar{
public:
Registrar();
~Registrar();

static void Register(Function*);

protected:
static BTree *Functions;
};


The class itself works, all the functions are error free. However, when the code is compiled and then linked, There is a Linker error saying "Unresolved External 'Registrar::Functions'"

I don't understand why this is, because Functions is a variable (a binary Tree) whose class is defined above this implementation. all it's functions work, and I have used that code before.

Can anyone help me?

--Josh

To properly answer your question, regarding the error, Why don't you try giving a type to Function* in the Register( Function* ) something along the line of:

static void Register( void Function* );

except that you should replace the void in front of Function* to what ever type is required. That should probably solve your problem.



"And that's the bottom line cause I said so!"

Cyberdrek

Resist Windows XP's Invasive Production Activation Technology!

"gitty up" -- Kramer
/(bb|[^b]{2})/ that is the Question -- ThinkGeek.com
Hash Bang Slash bin Slash Bash -- #!/bin/bash

Edited by - cyberdrek on January 1, 2002 1:50:28 AM

Share this post


Link to post
Share on other sites
Sorry I think you may have missunderstood.
"Function" IS a type. It''s defined by the code:
  
typedef void (*Function)(char*);


But there was no problem in that code, Just the declaration of the BTree was wrong. But all is good now, I have finished developing that code now.

It was actually a part of a Game Console, that section handled taking input, finding the right function to run, running it, and outputing what needed to be outputed.
I also designed it so that new functions could be added easily by making a small declaration just after the code for a function.

Thanks for all your help, and like I said. All errors are gone now!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!