Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 6

Qt-interest Archive, August 2007
Re: LNK2001: unresolved external symbol "public: static struct QMetaObject const QwtPlot::staticMetaObject"


Message 1 in thread

Martin Irman wrote:

> Lingfa Yang wrote:
>
>> I have moc on the .h file, and add the generated moc_PlotCurve.cpp to 
>> my project, but
>>
>> moc_PlotCurve.obj : error LNK2001: unresolved external symbol 
>> "public: static struct QMetaObject const QwtPlot::staticMetaObject" 
>> (?staticMetaObject@QwtPlot@@2UQMetaObject@@B)
>
>
> Could it be that you forgot to include the Q_OBJECT macro in this 
> QwtPlot class?

QwtPlot is a Qt graphic library. I double checked.  Q_OBJECT macro is in 
qwt_plot.h

I have this problem only in release mode  (my compiler is vs2003). In 
debug mode everything works fine.
So I believe the problem comes from wrongly linking to Qwt library.
In release mode I am using
Runtime library: Multi-threaded DLL (/MD)
which is consistent with qwt's compiling. I have no idea more than that.

Does anyone have experience working with qwt regarding debug/release 
compiler?
Lingfa




--
 [ signature omitted ] 

Message 2 in thread

The fact that you say it works under debug mode and not release mode
makes me think that your Visual Studio project settings are different
between debug and release modes.  I'm guess that in release mode, you've
forgotten to link in some file or some library path.  Check your Linker
settings in your Visual Studio Project and see if you can find something
different between release and debug modes...

Sean

-----Original Message-----
From: Lingfa Yang [mailto:lingfa@xxxxxxx] 
Sent: Friday, August 31, 2007 10:43 AM
To: qt-interest@xxxxxxxxxxxxx
Cc: qt-interest@xxxxxxxxxxxxx
Subject: Re: LNK2001: unresolved external symbol "public: static struct
QMetaObject const QwtPlot::staticMetaObject"

Martin Irman wrote:

> Lingfa Yang wrote:
>
>> I have moc on the .h file, and add the generated moc_PlotCurve.cpp to

>> my project, but
>>
>> moc_PlotCurve.obj : error LNK2001: unresolved external symbol
>> "public: static struct QMetaObject const QwtPlot::staticMetaObject" 
>> (?staticMetaObject@QwtPlot@@2UQMetaObject@@B)
>
>
> Could it be that you forgot to include the Q_OBJECT macro in this 
> QwtPlot class?

QwtPlot is a Qt graphic library. I double checked.  Q_OBJECT macro is in
qwt_plot.h

I have this problem only in release mode  (my compiler is vs2003). In
debug mode everything works fine.
So I believe the problem comes from wrongly linking to Qwt library.
In release mode I am using
Runtime library: Multi-threaded DLL (/MD) which is consistent with qwt's
compiling. I have no idea more than that.

Does anyone have experience working with qwt regarding debug/release
compiler?
Lingfa




--
 [ signature omitted ] 

Message 3 in thread

Sean, 

Thank you for your quick reply. This is a long lasting problem for me.

I have in debug:
"$(QTDIR)\lib\QtOpenGLd4.lib"
"$(QTDIR)\lib\QtGuid4.lib"
"$(QTDIR)\lib\QtCored4.lib"
"$(QTDIR)\lib\qtmaind.lib"
"$(QTDIR)\lib\QtXmld4.lib"
"$(QTDIR)\lib\QtNetworkd4.lib"
"$(QTDIR)\lib\QAxContainerd.lib"
"$(QWTDIR)\lib\qwt5d.lib"

in release mode switches to:
"$(QTDIR)\lib\QtOpenGL4.lib"
"$(QTDIR)\lib\QtGui4.lib"
"$(QTDIR)\lib\QtCore4.lib"
"$(QTDIR)\lib\qtmain.lib"
"$(QTDIR)\lib\QtXml4.lib"
"$(QTDIR)\lib\QtNetwork4.lib"
"$(QTDIR)\lib\QAxContainer.lib"
"$(QWTDIR)\lib\qwt5.lib"

 From "d" (debug) to "none-d" (release) uniformly.
Any other idea?
Thanks in advance.
Lingfa



Murphy, Sean M. wrote:

>The fact that you say it works under debug mode and not release mode
>makes me think that your Visual Studio project settings are different
>between debug and release modes.  I'm guess that in release mode, you've
>forgotten to link in some file or some library path.  Check your Linker
>settings in your Visual Studio Project and see if you can find something
>different between release and debug modes...
>
>Sean
>
>-----Original Message-----
>From: Lingfa Yang [mailto:lingfa@xxxxxxx] 
>Sent: Friday, August 31, 2007 10:43 AM
>To: qt-interest@xxxxxxxxxxxxx
>Cc: qt-interest@xxxxxxxxxxxxx
>Subject: Re: LNK2001: unresolved external symbol "public: static struct
>QMetaObject const QwtPlot::staticMetaObject"
>
>Martin Irman wrote:
>
>  
>
>>Lingfa Yang wrote:
>>
>>    
>>
>>>I have moc on the .h file, and add the generated moc_PlotCurve.cpp to
>>>      
>>>
>
>  
>
>>>my project, but
>>>
>>>moc_PlotCurve.obj : error LNK2001: unresolved external symbol
>>>"public: static struct QMetaObject const QwtPlot::staticMetaObject" 
>>>(?staticMetaObject@QwtPlot@@2UQMetaObject@@B)
>>>      
>>>
>>Could it be that you forgot to include the Q_OBJECT macro in this 
>>QwtPlot class?
>>    
>>
>
>QwtPlot is a Qt graphic library. I double checked.  Q_OBJECT macro is in
>qwt_plot.h
>
>I have this problem only in release mode  (my compiler is vs2003). In
>debug mode everything works fine.
>So I believe the problem comes from wrongly linking to Qwt library.
>In release mode I am using
>Runtime library: Multi-threaded DLL (/MD) which is consistent with qwt's
>compiling. I have no idea more than that.
>
>Does anyone have experience working with qwt regarding debug/release
>compiler?
>Lingfa
>
>
>
>
>--
>To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
>"unsubscribe" in the subject or the body.
>List archive and information: http://lists.trolltech.com/qt-interest/
>
>--
>To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
>List archive and information: http://lists.trolltech.com/qt-interest/
>
>  
>


--
 [ signature omitted ] 

Message 4 in thread

I don't really have too many more ideas, you could try asking on the Qwt
list to see if it's a common problem or not, but I really suspect it's a
Visual Studio setting, unless for some reason the qwt5d.lib contains the
desired symbol, but the qwt5.lib does not.

Sean

-----Original Message-----
From: Lingfa Yang [mailto:lingfa@xxxxxxx] 
Sent: Friday, August 31, 2007 11:08 AM
To: qt-interest@xxxxxxxxxxxxx
Cc: qt-interest@xxxxxxxxxxxxx
Subject: Re: LNK2001: unresolved external symbol "public: static struct
QMetaObject const QwtPlot::staticMetaObject"

Sean, 

Thank you for your quick reply. This is a long lasting problem for me.

I have in debug:
"$(QTDIR)\lib\QtOpenGLd4.lib"
"$(QTDIR)\lib\QtGuid4.lib"
"$(QTDIR)\lib\QtCored4.lib"
"$(QTDIR)\lib\qtmaind.lib"
"$(QTDIR)\lib\QtXmld4.lib"
"$(QTDIR)\lib\QtNetworkd4.lib"
"$(QTDIR)\lib\QAxContainerd.lib"
"$(QWTDIR)\lib\qwt5d.lib"

in release mode switches to:
"$(QTDIR)\lib\QtOpenGL4.lib"
"$(QTDIR)\lib\QtGui4.lib"
"$(QTDIR)\lib\QtCore4.lib"
"$(QTDIR)\lib\qtmain.lib"
"$(QTDIR)\lib\QtXml4.lib"
"$(QTDIR)\lib\QtNetwork4.lib"
"$(QTDIR)\lib\QAxContainer.lib"
"$(QWTDIR)\lib\qwt5.lib"

 From "d" (debug) to "none-d" (release) uniformly.
Any other idea?
Thanks in advance.
Lingfa



Murphy, Sean M. wrote:

>The fact that you say it works under debug mode and not release mode 
>makes me think that your Visual Studio project settings are different 
>between debug and release modes.  I'm guess that in release mode, 
>you've forgotten to link in some file or some library path.  Check your

>Linker settings in your Visual Studio Project and see if you can find 
>something different between release and debug modes...
>
>Sean
>
>-----Original Message-----
>From: Lingfa Yang [mailto:lingfa@xxxxxxx]
>Sent: Friday, August 31, 2007 10:43 AM
>To: qt-interest@xxxxxxxxxxxxx
>Cc: qt-interest@xxxxxxxxxxxxx
>Subject: Re: LNK2001: unresolved external symbol "public: static struct

>QMetaObject const QwtPlot::staticMetaObject"
>
>Martin Irman wrote:
>
>  
>
>>Lingfa Yang wrote:
>>
>>    
>>
>>>I have moc on the .h file, and add the generated moc_PlotCurve.cpp to
>>>      
>>>
>
>  
>
>>>my project, but
>>>
>>>moc_PlotCurve.obj : error LNK2001: unresolved external symbol
>>>"public: static struct QMetaObject const QwtPlot::staticMetaObject" 
>>>(?staticMetaObject@QwtPlot@@2UQMetaObject@@B)
>>>      
>>>
>>Could it be that you forgot to include the Q_OBJECT macro in this 
>>QwtPlot class?
>>    
>>
>
>QwtPlot is a Qt graphic library. I double checked.  Q_OBJECT macro is 
>in qwt_plot.h
>
>I have this problem only in release mode  (my compiler is vs2003). In 
>debug mode everything works fine.
>So I believe the problem comes from wrongly linking to Qwt library.
>In release mode I am using
>Runtime library: Multi-threaded DLL (/MD) which is consistent with 
>qwt's compiling. I have no idea more than that.
>
>Does anyone have experience working with qwt regarding debug/release 
>compiler?
>Lingfa
>
>
>
>
>--
>To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
>"unsubscribe" in the subject or the body.
>List archive and information: http://lists.trolltech.com/qt-interest/
>
>--
>To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
"unsubscribe" in the subject or the body.
>List archive and information: http://lists.trolltech.com/qt-interest/
>
>  
>


--
 [ signature omitted ] 

Message 5 in thread

Murphy, Sean M. wrote:

>I don't really have too many more ideas, you could try asking on the Qwt
>list 
>
Good idea. I will put there a post too.
Thank you,
Lingfa


--
 [ signature omitted ] 

Message 6 in thread

Did you build the qwt5.lib yourself? Maybe something went wrong there,
it seems as if the meta-object information is missing from that lib
(which is contained in the generated moc_*.cpp or *.moc files).

Make sure these are compiled and linked into your lib. The error message
is typical for not compiling / linking with the moc generated files.

Cheers,
Peter

> Any other idea?
> Thanks in advance.
> Lingfa

--
 [ signature omitted ] 

Message 7 in thread

Peter Prade wrote:

>Did you build the qwt5.lib yourself? 
>
Peter,

Yes, where the linker input is simpler:

"$(QTDIR)\lib\QtGuid4.lib"
"$(QTDIR)\lib\QtCored4.lib"

v.s.
"$(QTDIR)\lib\QtOpenGL4.lib"
"$(QTDIR)\lib\QtGui4.lib"

Your reply reminds me to rebuild. I just did a clean build on qwt, and 
my application. Unfortunately, problem remains.

Also I just built and run a qwt example on the same machine in both 
release and debug modes,
where everything looks fine, which indicates the liberay is fine.

If you have any other idea, please help.

Thank you,
Lingfa



--
 [ signature omitted ] 

Message 8 in thread

> -----Original Message-----
> From: Lingfa Yang [mailto:lingfa@xxxxxxx] 
> Sent: Friday, August 31, 2007 5:54 PM
> To: qt-interest@xxxxxxxxxxxxx
> Cc: qt-interest@xxxxxxxxxxxxx
> Subject: Re: LNK2001: unresolved external symbol "public: 
> static struct QMetaObject const QwtPlot::staticMetaObject"
> 
> 
> Peter Prade wrote:
> 
> >Did you build the qwt5.lib yourself? 
> >
> Peter,
> 
> Yes, where the linker input is simpler:
> 
[...]
> Your reply reminds me to rebuild. I just did a clean build on 
> qwt, and 
> my application. Unfortunately, problem remains.
> 
> Also I just built and run a qwt example on the same machine in both 
> release and debug modes,
> where everything looks fine, which indicates the liberay is fine.
> 
> If you have any other idea, please help.

What would be more interesting: what object files are compiled/linked
into qwt5.lib?
Did the clean build also create fresh moc files?

the error message is indicating that the moc'ed file of qwt_plot.h is
missing from your lib.

Did you test with an example that uses QwtPlot?

Cheers,
Peter

--
 [ signature omitted ] 

Message 9 in thread

Peter Prade wrote:

>>-----Original Message-----
>>From: Lingfa Yang [mailto:lingfa@xxxxxxx] 
>>Sent: Friday, August 31, 2007 5:54 PM
>>To: qt-interest@xxxxxxxxxxxxx
>>Cc: qt-interest@xxxxxxxxxxxxx
>>Subject: Re: LNK2001: unresolved external symbol "public: 
>>static struct QMetaObject const QwtPlot::staticMetaObject"
>>
>>
>>Peter Prade wrote:
>>
>>    
>>
>>>Did you build the qwt5.lib yourself? 
>>>
>>>      
>>>
>>Peter,
>>
>>Yes, where the linker input is simpler:
>>
>>    
>>
>[...]
>  
>
>>Your reply reminds me to rebuild. I just did a clean build on 
>>qwt, and 
>>my application. Unfortunately, problem remains.
>>
>>Also I just built and run a qwt example on the same machine in both 
>>release and debug modes,
>>where everything looks fine, which indicates the liberay is fine.
>>
>>If you have any other idea, please help.
>>    
>>
>
>What would be more interesting: what object files are compiled/linked
>into qwt5.lib?
>Did the clean build also create fresh moc files?
>  
>
Yes, I did again. I saw the all moc_*.* gone after clean, and remerged 
when rebuilt.

>the error message is indicating that the moc'ed file of qwt_plot.h is
>missing from your lib.
>
>Did you test with an example that uses QwtPlot?
>
>  
>
Yes, I did with qwt5.0.1\examples\bode, which does use QwtPlot. It works 
fine. I get so confused why in my application it doesn't.

Thank you again.
Lingfa


--
 [ signature omitted ] 

Message 10 in thread

> Yes, I did with qwt5.0.1\examples\bode, which does use 
> QwtPlot. It works 
> fine. I get so confused why in my application it doesn't.

I'm almost out of ideas here ;-)

What i'd try is to take the working example project file and copy and
modify it to build your project with. You probably have some
compiler/linker option set differently in your project that is causing
the linker error. Although it's confusing that you're not getting more
than just this one linker error then.

Cheers,
Peter

--
 [ signature omitted ] 

Message 11 in thread

Peter Prade wrote:

>>Yes, I did with qwt5.0.1\examples\bode, which does use 
>>QwtPlot. It works 
>>fine. I get so confused why in my application it doesn't.
>>    
>>
>
>I'm almost out of ideas here ;-)
>
>What i'd try is to take the working example project file and copy and
>modify it to build your project with. You probably have some
>compiler/linker option set differently in your project that is causing
>the linker error. Although it's confusing that you're not getting more
>than just this one linker error then.
>
>Cheers,
>Peter
>  
>
Peter,

That is a good suggestion. I am working on plugging in the successful 
example to see if it can give me some hints.

Thank you very much,
Lingfa



--
 [ signature omitted ] 

Message 12 in thread

Not sure if this is the case with you, but I once spend a *week* 
tracking down a problem
where visual studio would automatically strip off a trailing space in a 
library name in
one situation but not in another. It was really sneaky because the fact 
that one thing worked
"prevented" me from double checking the name more carefully. This was 
about 10 years
ago so I don't remember any of the specifics.

Another idea is to get visual studio to write out a make file and then 
line up the various
options/files between debug and release to see if you can spot anything.

And how about removing *all* .obj and library files that you make? 
Perhaps a dependency
isn't properly being analyzed and some  object is "bad"(?)

Lingfa Yang wrote:
> Sean,
> Thank you for your quick reply. This is a long lasting problem for me.
>
> I have in debug:
> "$(QTDIR)\lib\QtOpenGLd4.lib"
> "$(QTDIR)\lib\QtGuid4.lib"
> "$(QTDIR)\lib\QtCored4.lib"
> "$(QTDIR)\lib\qtmaind.lib"
> "$(QTDIR)\lib\QtXmld4.lib"
> "$(QTDIR)\lib\QtNetworkd4.lib"
> "$(QTDIR)\lib\QAxContainerd.lib"
> "$(QWTDIR)\lib\qwt5d.lib"
>
> in release mode switches to:
> "$(QTDIR)\lib\QtOpenGL4.lib"
> "$(QTDIR)\lib\QtGui4.lib"
> "$(QTDIR)\lib\QtCore4.lib"
> "$(QTDIR)\lib\qtmain.lib"
> "$(QTDIR)\lib\QtXml4.lib"
> "$(QTDIR)\lib\QtNetwork4.lib"
> "$(QTDIR)\lib\QAxContainer.lib"
> "$(QWTDIR)\lib\qwt5.lib"
>
> From "d" (debug) to "none-d" (release) uniformly.
> Any other idea?
> Thanks in advance.
> Lingfa
>
>
>
> Murphy, Sean M. wrote:
>
>> The fact that you say it works under debug mode and not release mode
>> makes me think that your Visual Studio project settings are different
>> between debug and release modes.  I'm guess that in release mode, you've
>> forgotten to link in some file or some library path.  Check your Linker
>> settings in your Visual Studio Project and see if you can find something
>> different between release and debug modes...
>>
>> Sean
>>
>> -----Original Message-----
>> From: Lingfa Yang [mailto:lingfa@xxxxxxx] Sent: Friday, August 31, 
>> 2007 10:43 AM
>> To: qt-interest@xxxxxxxxxxxxx
>> Cc: qt-interest@xxxxxxxxxxxxx
>> Subject: Re: LNK2001: unresolved external symbol "public: static struct
>> QMetaObject const QwtPlot::staticMetaObject"
>>
>> Martin Irman wrote:
>>
>>  
>>
>>> Lingfa Yang wrote:
>>>
>>>   
>>>> I have moc on the .h file, and add the generated moc_PlotCurve.cpp to
>>>>     
>>
>>  
>>
>>>> my project, but
>>>>
>>>> moc_PlotCurve.obj : error LNK2001: unresolved external symbol
>>>> "public: static struct QMetaObject const QwtPlot::staticMetaObject" 
>>>> (?staticMetaObject@QwtPlot@@2UQMetaObject@@B)
>>>>     
>>> Could it be that you forgot to include the Q_OBJECT macro in this 
>>> QwtPlot class?
>>>   
>>
>> QwtPlot is a Qt graphic library. I double checked.  Q_OBJECT macro is in
>> qwt_plot.h
>>
>> I have this problem only in release mode  (my compiler is vs2003). In
>> debug mode everything works fine.
>> So I believe the problem comes from wrongly linking to Qwt library.
>> In release mode I am using
>> Runtime library: Multi-threaded DLL (/MD) which is consistent with qwt's
>> compiling. I have no idea more than that.
>>
>> Does anyone have experience working with qwt regarding debug/release
>> compiler?
>> Lingfa
>>
>>
>>
>>
>> -- 
>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
>> "unsubscribe" in the subject or the body.
>> List archive and information: http://lists.trolltech.com/qt-interest/
>>
>> -- 
>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx 
>> with "unsubscribe" in the subject or the body.
>> List archive and information: http://lists.trolltech.com/qt-interest/
>>
>>  
>>
>
>
> -- 
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>

--
 [ signature omitted ]