Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 The problem about the pointer of function and the calling of a subfunction
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
CHINA_yanglei




PostPosted: Sun Mar 22, 2009 3:41 am   Post subject: The problem about the pointer of function and the calling of a subfunction

c++:
#include <iostream>
void FileFunc();
void EditFunc();
int main()
{   
        void (*funcp)();
        funcp=FileFunc;
        (*funcp)();
        funcp=EditFunc;
        (*funcp)();

    return 0;
}
void Filefunc()
{
        std::cout<<"File function1"<<std::endl;
}
void EditFunc()
{
        std::cout<<"Edit function"<<std::endl;
}


code:
group.obj : error LNK2001: unresolved external symbol "void __cdecl FileFunc(void)" (?FileFunc@@YAXXZ)
Debug/group.exe : fatal error LNK1120: 1 unresolved externals


Thank for your advice!

Mod Edit: Remember to use syntax and code tags! Thanks Smile
code:
[syntax="cpp"]Code Here[/syntax]
Sponsor
Sponsor
Sponsor
sponsor
cavetroll




PostPosted: Sun Mar 22, 2009 10:58 am   Post subject: Re: The problem about the pointer of function and the calling of a subfunction

You just made a typo on the lines

code:

void Filefunc()
{
std::cout<<"File function1"<<std::endl;
}


should be
code:

void FileFunc()
{
std::cout<<"File function1"<<std::endl;
}



That got it working for me.
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: