By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,045 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

undefine sysbol comm_init(int)

P: 4
i use borland c programing for adam-4500. My code:
#include"adam4500.h"
void main(void)
{
if (!comm_init (1000))
{
printf(" initialization failed!");
delay(1000);
exit();
}
}
i took all files into example1 directory : inc and lib directories of turbo c, and adam4500.h header file . when i compile it not error and not warring, but when i build all it has one error :
linker error: undefined symbol comm_init(int) in module TIEP.CPP
can you help me repair this error!
Nov 11 '10 #1
Share this Question
Share on Google+
7 Replies


100+
P: 256
The linker can't find the code to link for the comm_init function. Where's the code for it? Is it supposed to come from adam4500? If so, maybe you need to make sure it's being compiled and linked in (and not just #included).

Otherwise, if the function is in a different file you need to #include and compile/link it.
Nov 11 '10 #2

P: 4
yes, adam4500.h isn't a header file of borland c. I have linked to the directory containing the header files . but this error msg still appear.
Nov 12 '10 #3

Banfa
Expert Mod 5K+
P: 8,916
The header files only tell the compiler that the functions exist, the contain declarations of the function. The linker will need the definition (the actual code) of the function.

If you have a header file (adam4500.h) containing the function declaration then you should also have a library (.lib or .a) or possibly an object (.o or .obj) containing the definition of the function that needs to be supplied to the linker.
Nov 12 '10 #4

P: 4
thank you.i added all .lib files of adam into directory and linked to that directory. but error message still appear. i don't know how i should do.
Nov 12 '10 #5

Banfa
Expert Mod 5K+
P: 8,916
Look up the documentation of that function and see which library it says you need to use.
Nov 12 '10 #6

P: 4
yes, i looked up and added library that i need to use into directory. but still not right. so i added all file in library of adam. and the result remain the same.
Nov 12 '10 #7

Banfa
Expert Mod 5K+
P: 8,916
You do not need to add the libraries to your source directory, you should leave them where they were installed.

You need to add the libraries (and possibly a library path) to your linker command.
Nov 12 '10 #8

Post your reply

Sign in to post your reply or Sign up for a free account.