Skip to main content
gamedev.net
🔒 Locked

C++ linking error help

Started by DimSum Oct 8, 2002 at 2:36 PM 4 replies 950+ views
Original Post
DimSum
DimSum
Hi all, I've been stumped on this C++ linking error for the last hour. I have a class that inherits CSocket: class CServerSocket : public CSocket { //constructor public: CServerSocket(); ... } And then I'm declare an instance of this class in a header file (File.h): CServerSocket* pSocket; And then I try to create a new instance of this variable in the corresponding File.cpp: pSocket = new CServerSocket (); When I build this I keep getting a linking error: error LNK2019: unresolved external symbol "public: __thiscall CServerSocket::CServerSocket(void)" (??0CServerSocket@@QAE@XZ) referenced in function "public: void __thiscall CMetricServerDlg::OnBnClickedStart(void)" (?OnBnClickedStart@CMetricServerDlg@@QAEXXZ) MetricServer fatal error LNK1120: 1 unresolved externals Can anyone tell me how to fix this?? I'm stumped... [edited by - DimSum on October 8, 2002 3:42:23 PM]
twanvl
twanvl
You have to impelement the constructor of CServerSocket, either inline (instead of the semicolon) or outside the class:

  
CServerSocket::CServerSocket()
{
// your code here (if any)

}
DimSum
DimSum
I have a contructor definition like the following. And its being defined in the corresponding class file.


CServerSocket::CServerSocket()
{
// Does nothing at the moment
}


But i''m still getting the errors. Is my constructor faulty here???
Qw3r7yU10p!
Qw3r7yU10p!
is the cpp file with the implementation included in your project (if you''re using vc++), or named in your make file (if you''re not)
DimSum
DimSum
AAAAHHHHH!!!!
Thanks man!!
that was it!!... forgot to include it in my project. ugh

thanks again

-Phil
Qw3r7yU10p!
Qw3r7yU10p!
experience is the best teacher

glad to be able to help (c:

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.