Archived

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

redneckCoder

function in library

Recommended Posts

Hey y''all, I''m coding a simple graphics library and everthing''s going all right except when I try to call a function from the library, I always get this error: unresolved external symbol _FunctionName 1 unresolved externals After the first time I got this error I went back and made all my functions external with the ''extern'' keyword, but that gave me the same error. What''s wrong? -AJ

Share this post


Link to post
Share on other sites
It''s a linkage error. It can''t find that function. If it''s a C function make sure the header has a C++ check to add extern "C" { et cetera } around the extern prototypes. I''m assuming you are linking the source/object/library/whatever files with the actual function in it.

Share this post


Link to post
Share on other sites
Like this:

#ifdef __cplusplus
extern "C" {
#endif
void YourFunction();
#ifdef __cplusplus
}
#endif

This should be in your .h file. As N&V said, make sure you are actually linking with your library.

Share this post


Link to post
Share on other sites