Pelles C forum

Pelles C => General discussions => Topic started by: Muhammed on June 03, 2007, 02:21:58 AM

Title: librarys
Post by: Muhammed on June 03, 2007, 02:21:58 AM
Hello,

I've a problem:

I wanted to make a library and use it in a program but I just got this error-messages:

POLINK: error: Unresolved external symbol '_test'.
POLINK: fatal error: 1 unresolved external(s).

This are the files:

The Header:

#ifndef TEST_H
#define TEST_H

#include <stdio.h>

int test(void);

#endif   


The lib:

#include <test.h>

int test(void)
{

printf("Test\n");


return 0;
}


and at last the file which should use the lib:

#include <test.h>
#pragma comment (lib, "test.lib");

int main ()

{

test();


    return 0;

}


The header and the lib are in the right folders.
The pathes to the folders (in (the) project options) are also set right.

Maybe you can help me,

Thank You
Title: Re: librarys
Post by: Muhammed on June 03, 2007, 03:44:43 PM
Is there no-one who can help me?

Title: Re: librarys
Post by: JohnF on June 03, 2007, 04:49:24 PM
I've just made the lib and tested it with your test code, no problems. So I can't say what you are doing wrong.


There are two things you should put right however.

#include "test.h"

int main(void)


John

Title: Re: librarys
Post by: TimoVJL on June 03, 2007, 04:50:43 PM
use same calling conventions in program and library or use keywords _cdecl or _stdcall

Title: Re: librarys
Post by: Muhammed on June 05, 2007, 02:40:25 PM
Hello,

thank you, I tried so but it also not works.
I'll try it again ma I made a mistake but if not I don't know whats wrong
Title: Re: librarys
Post by: TimoVJL on June 05, 2007, 05:37:20 PM
This was my working test project.
Title: Re: librarys
Post by: Muhammed on June 06, 2007, 03:52:00 PM
Thank you very much!