Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calling a function from different VC++ project

Status
Not open for further replies.

avivhal

Programmer
Nov 14, 2001
9
NL
I'm trying to call a function from more then 1 project .
I do the following:

in one project i wrote:
int ChosenPort;
extern int GetPort(){return ChosenPort;}

from another i try to call the function:
int ChosenPort;
ChosenPort=GetPort();

I get a linking error:
error LNK2001: unresolved external symbol _GetPort


please help me if you can.
Thanks heaps.
Aviv.
 
You would need the implementation of the function included in your program BUT it looks like you are doing some tcp/ip stuff (or named pipes) In either case, I would put a function into the "Listener" to return the port. Request the port from the Listener and use that. The way to do this would be to start the apps with a hard coded base port number that is the same to both. Talk over that port until the new port is specified and then configure it to do that. That would be the easiest approach (i think)

Matt
 
I am doing TCP/IP stuff , but this is the lowest software level that needs to communicate with one level higher.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top