NO

Author Topic: librarys  (Read 3514 times)

Muhammed

  • Guest
librarys
« 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:

Code: [Select]
#ifndef TEST_H
#define TEST_H

#include <stdio.h>

int test(void);

#endif   

The lib:

Code: [Select]
#include <test.h>

int test(void)
{

printf("Test\n");


return 0;
}

and at last the file which should use the lib:

Code: [Select]
#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
« Last Edit: June 03, 2007, 02:51:25 PM by Muhammed »

Muhammed

  • Guest
Re: librarys
« Reply #1 on: June 03, 2007, 03:44:43 PM »
Is there no-one who can help me?


JohnF

  • Guest
Re: librarys
« Reply #2 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


Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: librarys
« Reply #3 on: June 03, 2007, 04:50:43 PM »
use same calling conventions in program and library or use keywords _cdecl or _stdcall

May the source be with you

Muhammed

  • Guest
Re: librarys
« Reply #4 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

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: librarys
« Reply #5 on: June 05, 2007, 05:37:20 PM »
This was my working test project.
May the source be with you

Muhammed

  • Guest
Re: librarys
« Reply #6 on: June 06, 2007, 03:52:00 PM »
Thank you very much!