How to call a function from one project to a function in another project ???

S

Sandeep Chikkerur

Hi,

How do I call a function from one project to a function in another project?

e.g. In VC++ environment, if u've two different projects , say proj1 & proj2

/**************************** PROJ1 ************************************/

/******* main.c ***********/

#include <stdio.h>
#include "func_def.h"

void main()
{
fun();
}
/**************************/

/****** func_def.c ********/
void fun()
{
printf(".....");
}
/*************************/

/*************************** END OF PROJ1 ******************************/

If this project resides in : C:\Pro1
===========================================================================


Now project 2:

/******************************* PROJ2 ********************************/


/******* main2.c ***********/

#include <stdio.h>
#include "..\pro1\func_def.h"

void main()
{
fun();
}
/**************************/

/***************************** END OF PROJ2 ****************************/

If this project resides in say C:\Pro2




While pro2 is being linked it throws 'Unresolved external symbol _fun' error

How do I overcome this error & build the project successfully???

Thanking in advance...
~Sandeep
 
J

Jack Klein

Hi,

How do I call a function from one project to a function in another project?

The C language doesn't have anything called "projects".
e.g. In VC++ environment, if u've two different projects , say proj1 & proj2

/**************************** PROJ1 ************************************/

/******* main.c ***********/

#include <stdio.h>
#include "func_def.h"

void main()

The only portable standard return type for main() in C is int.
{
fun();
}
/**************************/

/****** func_def.c ********/
void fun()
{
printf(".....");
}
/*************************/

/*************************** END OF PROJ1 ******************************/

If this project resides in : C:\Pro1
===========================================================================


Now project 2:

/******************************* PROJ2 ********************************/


/******* main2.c ***********/

#include <stdio.h>
#include "..\pro1\func_def.h"

void main()
{
fun();
}
/**************************/

/***************************** END OF PROJ2 ****************************/

If this project resides in say C:\Pro2




While pro2 is being linked it throws 'Unresolved external symbol _fun' error

How do I overcome this error & build the project successfully???

Thanking in advance...
~Sandeep

Ask in a group like C
doesn't have "projects".

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top