// mainfrm.h
enum
{		
    logAll = 0xff
};
void Log(int nIdx, LPCTSTR lpText, int nType = logAll, LPCTSTR lpDeviceName = NULL);

//SesLog.h
int m_nDeviceID;
CString m_strDeviceName;

// SesLog.cpp
#include "Mainfrm.h"
#include "SesLog.h"
void CSessionLog::Log(LPCSTR lpText)
{
	if(m_pParent)
		m_pParent->Log(m_nDeviceID, lpText, logAll, m_strDeviceName);

error LNK2019: unresolved external symbol "public: void __thiscall CMainFrame::Log(int,char const *,int,char const *)" (?Log@CMainFrame@@QAEXHPBDH0@Z) referenced in function "public: void __thiscall CSessionLog::Log(char const *)" (?Log@CSessionLog@@QAEXPBD@Z) \SesLog.obj

VS 2010
Help would be appreciated.

Thanks

Recommended Answers

All 7 Replies

Never mind this post.

The overload of m_pParent->Log() you're calling isn't defined anywhere that the compiler can see. To start, make sure it has a definition for the type and number of arguments you're passing.

Ok i added line
void Log(int, LPCTSTR, int, LPCTSTR);
in SesLog.cpp
Still getting that error.

Thanks

Clearly you don't understand the difference between a declaration and a definition. What you added was a declaration, but what's missing is a definition. Have you written a body for that overload of Log anywhere?

Oh yes ..
There is no definition for that.

I converted old C++ code to .Net C++.

Thanks

Ok i figured out that the header file MainFrm.h is coming from ..\rhub\mainfrm.h.
& in that rhub directory too it has Mainfrm.cpp which has Log function.

Now what do i need to do to call the function from that .cpp?
Should i add that cpp in my project ?

Advice
Thanks

Unless there's a library for you to link with, adding the .cpp file to your project should be sufficient.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.