C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

error LNK2019 problem

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Nicros
Guest





PostPosted: Mon Nov 28, 2005 5:51 am    Post subject: error LNK2019 problem Reply with quote



Hi,

I have a simple project, with a main application and a static library.
I call a function from one of the classes in the static lib, but during
compile time I get the LNK2019 problem.

Strange thing is that if I call a different function there is no compile
error with that one. Both public, both defined in the header and
implemented in the cpp file.

I have triple checked that my libraries are linked correctly... all
other functions and classes are linked just fine... just this one
function is a problem.

Any suggestions on what it may be?

Thanks
Back to top
John Harrison
Guest





PostPosted: Mon Nov 28, 2005 8:21 am    Post subject: Re: error LNK2019 problem Reply with quote



Nicros wrote:
Quote:
Hi,

I have a simple project, with a main application and a static library. I
call a function from one of the classes in the static lib, but during
compile time I get the LNK2019 problem.

Strange thing is that if I call a different function there is no compile
error with that one. Both public, both defined in the header and
implemented in the cpp file.

I have triple checked that my libraries are linked correctly... all
other functions and classes are linked just fine... just this one
function is a problem.

Any suggestions on what it may be?

Thanks

Perhaps you have declared one function in the header and implemented a
different function in the cpp file.

Why not show us the code? Cut and paste it from your cpp file and header
file.

john

Back to top
Howard
Guest





PostPosted: Mon Nov 28, 2005 3:35 pm    Post subject: Re: error LNK2019 problem Reply with quote




"John Harrison" <john_andronicus (AT) hotmail (DOT) com> wrote

Quote:
Nicros wrote:
Hi,

I have a simple project, with a main application and a static library. I
call a function from one of the classes in the static lib, but during
compile time I get the LNK2019 problem.

Strange thing is that if I call a different function there is no compile
error with that one. Both public, both defined in the header and
implemented in the cpp file.

I have triple checked that my libraries are linked correctly... all other
functions and classes are linked just fine... just this one function is a
problem.

Any suggestions on what it may be?

Thanks

Perhaps you have declared one function in the header and implemented a
different function in the cpp file.

Why not show us the code? Cut and paste it from your cpp file and header
file.


You should also include the text of that link error. Error codes like
"LNK2019" are specific to your compiler (and possibly even just that version
of the compiler), and we have no way to know what it means, or to what
functions or files it is referring.

-Howard





Back to top
Nicros
Guest





PostPosted: Tue Nov 29, 2005 3:55 am    Post subject: Re: error LNK2019 problem Reply with quote


Quote:


You should also include the text of that link error. Error codes like
"LNK2019" are specific to your compiler (and possibly even just that version
of the compiler), and we have no way to know what it means, or to what
functions or files it is referring.

-Howard


Here is the linker error:
AutomatonViewer error LNK2019: unresolved external symbol "public: void
__thiscall CSimulator::StartSimulation(class ATL::CStringT<char,class
StrTraitMFC_DLL > &,class
ATL::CStringT<char,class StrTraitMFC_DLL ATL::ChTraitsCRT > &)"
(?StartSimulation@CSimulator@@QAEXAAV?$CStringT@DV?$StrTraitMFC_DLL@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@0@Z)
referenced in function "public: void __thiscall
CAutomatonViewerDoc::OnSimulationRun(void)"
(?OnSimulationRun@CAutomatonViewerDoc@@QAEXXZ)


Here is the function declaration from the header for class CSimulator:
void StartSimulation(CString& cstrPathInit, CString& cstrPathArchive);

And from the cpp file:
void CSimulator::StartSimulation(CString& cstrPathInit, CString&
cstrPathArchive)
{

}

The call:
void CAutomatonViewerDoc::OnSimulationRun()
{
m_simulator.StartSimulation(m_cstrPathInitFile, m_cstrPathArchive);
}

Back to top
John Harrison
Guest





PostPosted: Tue Nov 29, 2005 7:10 am    Post subject: Re: error LNK2019 problem Reply with quote

Nicros wrote:
Quote:



You should also include the text of that link error. Error codes like
"LNK2019" are specific to your compiler (and possibly even just that
version of the compiler), and we have no way to know what it means, or
to what functions or files it is referring.

-Howard


Here is the linker error:
AutomatonViewer error LNK2019: unresolved external symbol "public: void
__thiscall CSimulator::StartSimulation(class ATL::CStringT<char,class
StrTraitMFC_DLL > &,class
ATL::CStringT<char,class StrTraitMFC_DLL ATL::ChTraitsCRT > &)"
(?StartSimulation@CSimulator@@QAEXAAV?$CStringT@DV?$StrTraitMFC_DLL@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@0@Z)
referenced in function "public: void __thiscall
CAutomatonViewerDoc::OnSimulationRun(void)"
(?OnSimulationRun@CAutomatonViewerDoc@@QAEXXZ)


Here is the function declaration from the header for class CSimulator:
void StartSimulation(CString& cstrPathInit, CString& cstrPathArchive);

And from the cpp file:
void CSimulator::StartSimulation(CString& cstrPathInit, CString&
cstrPathArchive)
{

}

The call:
void CAutomatonViewerDoc::OnSimulationRun()
{
m_simulator.StartSimulation(m_cstrPathInitFile, m_cstrPathArchive);
}


One posssible explaination, check that the StartSimulation function is
declared in the public part of the CSimulator class.

Failing that, I suggest physically deleteing all the object and library
files and rebuilding your entire project.

And failing that post the entire code, or put it on a web site and post
the link.

john

Back to top
Howard
Guest





PostPosted: Tue Nov 29, 2005 3:25 pm    Post subject: Re: error LNK2019 problem Reply with quote


"John Harrison" <john_andronicus (AT) hotmail (DOT) com> wrote

Quote:
Nicros wrote:



You should also include the text of that link error. Error codes like
"LNK2019" are specific to your compiler (and possibly even just that
version of the compiler), and we have no way to know what it means, or
to what functions or files it is referring.

-Howard


Here is the linker error:
AutomatonViewer error LNK2019: unresolved external symbol "public: void
__thiscall CSimulator::StartSimulation(class ATL::CStringT<char,class
StrTraitMFC_DLL > &,class
ATL::CStringT<char,class StrTraitMFC_DLL ATL::ChTraitsCRT > &)"
(?StartSimulation@CSimulator@@QAEXAAV?$CStringT@DV?$StrTraitMFC_DLL@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@0@Z)
referenced in function "public: void __thiscall
CAutomatonViewerDoc::OnSimulationRun(void)"
(?OnSimulationRun@CAutomatonViewerDoc@@QAEXXZ)


Here is the function declaration from the header for class CSimulator:
void StartSimulation(CString& cstrPathInit, CString& cstrPathArchive);

And from the cpp file:
void CSimulator::StartSimulation(CString& cstrPathInit, CString&
cstrPathArchive)
{

}

The call:
void CAutomatonViewerDoc::OnSimulationRun()
{
m_simulator.StartSimulation(m_cstrPathInitFile, m_cstrPathArchive);
}


One posssible explaination, check that the StartSimulation function is
declared in the public part of the CSimulator class.

Declaring that as private or protected wouldn't result in a linker error.
It would result in a compile error.

A better place to ask might be an MFC newsgroup. It's some project setup
issue, not anything related to the C++ code itself. There's certainly
nothing in that code that will tell us for sure what the problem is.
(Perhaps something related to linking with that ATL namespace?)

-Howard




Back to top
John Harrison
Guest





PostPosted: Tue Nov 29, 2005 10:02 pm    Post subject: Re: error LNK2019 problem Reply with quote

Quote:

One posssible explaination, check that the StartSimulation function is
declared in the public part of the CSimulator class.


Declaring that as private or protected wouldn't result in a linker error.
It would result in a compile error.

Not if CAutomatonViewerDoc was declared a friend of CSimulator. It was
the best I could think of.

john

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.