News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

librarys

Started by Muhammed, June 03, 2007, 02:21:58 AM

Previous topic - Next topic

Muhammed

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

Muhammed

Is there no-one who can help me?


JohnF

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


TimoVJL

use same calling conventions in program and library or use keywords _cdecl or _stdcall

May the source be with you

Muhammed

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

TimoVJL

This was my working test project.
May the source be with you

Muhammed

Thank you very much!