ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a small problem with the include clause. The fucntions i have declared inside the .h files pop up an "unresolved function-name". Its like the include is not there at all. Any ideas anyone. BTW, other questions can be posted here as well.
Well, if the compiler complains about some code inside that .h file,
then it must have been included.
A little bit of the offending code might be helpful...
Yep, as homer j said ... if you get something about
unresolved you're already past the compile, the header
has been inlcuded, but the linker can't find the object
code that matches the funtion the header described.
And more info would definitely help in assessing
this problem ;) ... e.g. a copy and paste of the error
message would be helpful.
The functions are declared yet not implemented in the .h file. I have another file with the exact same name but with the extension .pc, where the fucntion declared in the .h is implemented.
#include "atcli031.h" // this is the .h file include in the file that uses the fucntion
extern int atcli031_Consulta_conceptos_recibo_detalle (atcli031_conceptos_recibo_detalle_Arg * , char** );
//this is the function declared here in the .h file
//The implementation is in the atcli031.pc file like follows:
extern int atcli031_Consulta_conceptos_recibo_detalle(atcli031_conceptos_recibo_detalle_Arg *lsp_conceptos_recibo_detalle_Arg, char **pcp_Out )
{
int li_Status;
char * lcp_Out;
long ll_Contador = 0;
atcli031_conceptos_recibo_detalle *lsp_conceptos_recibo_detalle;
// the rest of the code goes here
return 0;
}
//After this, i include #include "atcli031.h" in another file called call_031.c like follows
#include "fgen.h"
#include "atcli031.h"
//Then i try to call the function atcli031_Consulta_conceptos_recibo_detalle like this
int main()
{
char* ll_Nis_Rad = "3231659";
char* ll_Sec_Nis = "1";
char* ll_Sec_Rec = "0";
call_031.c is the file i am trying to compile. Inside i have an include of #include "atcli031.h", that contains only a definition of the function "atcli031_Consulta_conceptos_recibo_detalle(atcli031_conceptos_recibo_detalle_Arg *lsp_conceptos_recibo_detalle_Arg, char **pcp_Out )". The implementation of this function is in a .pc file. I guess you are right, i need to link the .pc file with the .h file and then the .h file with call_031.c. The thing is i have no .o files anywhere. Am i completely lost here?
Here is what i wrote in the command line:
cc call031.c atcli_031.o -o call031
I got some warnings that have nothing to do with the issue. But here is the full description of the other problem i get regarding the function:
ld:
Can't open: atcli031.o (No such file or directory)
How do i create the .o file?
It's actually pro c code. It's c. I have no idea why it is set up this way, but i have to work with it. Definitions of structs and functions in .h files and the implementation in .pc files. The code i put on one of my replies shows how the atcli031.pc file looks like, and how it is called from the .c file, the one i am compiling, or trying. Jejejeje.
The terminal i use at work does not accept gcc, only cc. I came home and tried the gcc and it does work. What i understand you're saying is to compile the .pc file, that creates the .o file, and then compile the .c file with the .o file option, am i correct?
I've worked out another solution for the first problem, but no i want to start relearning C at home, and i want to use the mysql engine that i read comes with mandrake. Or maybe i read that wrong. Can i set up mysql database on mandrake and start connecting with C?
BTW, i have the simple "Hello World example" and i get a damn warning i have no idea what it means.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.