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

Qt-jambi-interest Archive, August 2006
Trying to create my own jambi widget


Message 1 in thread

from native code. I have tried to rewrite the bat and pro files in the 
generator_example directory to fit my own structure, but at last I ended 
up with this show-stopper:

        link /LIBPATH:"c:\Qt\4.1.3\lib" /NOLOGO  /INCREMENTAL:NO /DLL 
/OUT:"..\lib\com_trolltech_examples
_generator.dll" @C:\DOCUME~1\Helge\LOCALS~1\Temp\nm189.tmp
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other 
libs; use /NODEFAULTLIB:library
common-dllmtd.lib(CLog.obj) : error LNK2019: unresolved external symbol 
__imp__MessageBoxA@16 referenced in function "pu
blic: static void __cdecl common::CLog::fatalError(char const *,...)" 
(?fatalError@CLog@common@@SAXPBDZZ)
..\lib\com_trolltech_examples_generator.dll : fatal error LNK1120: 1 
unresolved externals
NMAKE : fatal error U1077: 'link' : return code '0x460'
Stop.
NMAKE : fatal error U1077: '"c:\Program Files\Microsoft Visual Studio 
.NET 2003\Vc7\bin\nmake.exe"' : return code '0x2'
Stop.

(Yuk!; I can't wait to get my widget into the java side...)

Probably due to some disharmony on compiler flags beeing used between 
different objs, but
I found no way to implement the recommended /NODEFAULTLIB:msvcrtd.lib in 
the pro file.

Any clue? I will suggest you to envise an integration with Visual Studio 
instead of
the bat/pro stuff.

Best regards,
Helge Fredriksen


Message 2 in thread

Hi, Helge.

Helge Fredriksen wrote:

> common-dllmtd.lib(CLog.obj) : error LNK2019: unresolved external 
> symbol __imp__MessageBoxA@16 referenced in function "pu
> [..]
> Any clue? I will suggest you to envise an integration with Visual 
> Studio instead of
> the bat/pro stuff.

If you are using the Win32 function "MessageBox", then you need to link 
with user32.lib. This can be done by editing the .pro-file of your 
project (generator_example.pro, if you haven't changed it) and adding 
the following line:

    LIBS += -luser32

Run qmake again and then nmake, and it should hopefully link :-)

-- Eskil


Message 3 in thread

On Wednesday 09 August 2006 09:59, Eskil A. Blomfeldt wrote:
> Hi, Helge.
>
> Helge Fredriksen wrote:
> > common-dllmtd.lib(CLog.obj) : error LNK2019: unresolved external
> > symbol __imp__MessageBoxA@16 referenced in function "pu
> > [..]
> > Any clue? I will suggest you to envise an integration with Visual
> > Studio instead of
> > the bat/pro stuff.
>
> If you are using the Win32 function "MessageBox", then you need to link
> with user32.lib. This can be done by editing the .pro-file of your
> project (generator_example.pro, if you haven't changed it) and adding
> the following line:
>
>     LIBS += -luser32
>
> Run qmake again and then nmake, and it should hopefully link :-)

Why not simply use QMessageBox?
http://doc.trolltech.com/4.1/qmessagebox.html

Matthias


Message 4 in thread

Matthias Ettrich wrote:
> On Wednesday 09 August 2006 09:59, Eskil A. Blomfeldt wrote:
>   
>> Hi, Helge.
>>
>> Helge Fredriksen wrote:
>>     
>>> common-dllmtd.lib(CLog.obj) : error LNK2019: unresolved external
>>> symbol __imp__MessageBoxA@16 referenced in function "pu
>>> [..]
>>> Any clue? I will suggest you to envise an integration with Visual
>>> Studio instead of
>>> the bat/pro stuff.
>>>       
>> If you are using the Win32 function "MessageBox", then you need to link
>> with user32.lib. This can be done by editing the .pro-file of your
>> project (generator_example.pro, if you haven't changed it) and adding
>> the following line:
>>
>>     LIBS += -luser32
>>
>> Run qmake again and then nmake, and it should hopefully link :-)
>>     
>
> Why not simply use QMessageBox?
> http://doc.trolltech.com/4.1/qmessagebox.html
>   

I'm not sure where the messagebox symbol came from, not my code really. 
I'm just a java dude trying to reuse some
custom made qt widgets. The user32 linking got me a bit further, but I'm 
now struggeling with this:

Compiling Java Sources
com\trolltech\examples\GeneratorExample.java:21: cannot find symbol
symbol  : class MyWidget
location: package com.trolltech.examples.generator
import com.trolltech.examples.generator.MyWidget;
                                        ^
com\trolltech\examples\generator\CMapDisplay.java:10: cannot find symbol
symbol  : class Signal6
location: class com.trolltech.examples.generator.CMapDisplay
    public Signal6<java.lang.Integer, java.lang.Integer, 
java.lang.Double, java.lang.Double, java.lang.Double, java.lang
.Double> mouseMove;
           ^
com\trolltech\examples\GeneratorExample.java:29: cannot find symbol
symbol  : class MyWidget
location: class com.trolltech.examples.GeneratorExample
        layout.addWidget(new MyWidget(this));
                             ^
com\trolltech\examples\generator\CMapDisplay.java:223: cannot find symbol
symbol  : variable __qt_no_notify
location: class com.trolltech.examples.generator.CMapDisplay
   protected void __qt_signalInitialization() { __qt_no_notify = true; 
__qt_signalInitialization(nativeId()); __qt_no_no
tify = false; m_cpp_signals_initialized = true; }
                                                ^
com\trolltech\examples\generator\CMapDisplay.java:223: cannot find symbol
symbol  : variable __qt_no_notify
location: class com.trolltech.examples.generator.CMapDisplay
   protected void __qt_signalInitialization() { __qt_no_notify = true; 
__qt_signalInitialization(nativeId()); __qt_no_no
tify = false; m_cpp_signals_initialized = true; }
                                                                                                              
^
com\trolltech\examples\generator\CMapDisplay.java:223: cannot find symbol
symbol  : variable m_cpp_signals_initialized
location: class com.trolltech.examples.generator.CMapDisplay
   protected void __qt_signalInitialization() { __qt_no_notify = true; 
__qt_signalInitialization(nativeId()); __qt_no_no
tify = false; m_cpp_signals_initialized = true; }

              ^
I have no reference to MyWidget in my sample scripts/code, is this 
hardcoded somewhere?

Helge Fredriksen


Message 5 in thread

Hi, Helge.

Helge Fredriksen wrote:

> [...]
> com\trolltech\examples\generator\CMapDisplay.java:223: cannot find symbol
> symbol  : variable m_cpp_signals_initialized
> location: class com.trolltech.examples.generator.CMapDisplay
>   protected void __qt_signalInitialization() { __qt_no_notify = true; 
> __qt_signalInitialization(nativeId()); __qt_no_no
> tify = false; m_cpp_signals_initialized = true; }
>
>              ^
> I have no reference to MyWidget in my sample scripts/code, is this 
> hardcoded somewhere?

Yes, GeneratorExample.java is a handwritten file that we ship for 
testing the generator example, so that part is expected as long as you 
haven't generated the bindings for the MyWidget class.

The other errors seem to imply that your generated java class is not 
extending QObject, so this may be a problem with the generator. Could 
you please check the super class of your CMapDisplay class, both in the 
C++ and Java implementations?

-- Eskil




Message 6 in thread

Eskil A. Blomfeldt wrote:
> Hi, Helge.
>
> Helge Fredriksen wrote:
>
>> [...]
>> com\trolltech\examples\generator\CMapDisplay.java:223: cannot find 
>> symbol
>> symbol  : variable m_cpp_signals_initialized
>> location: class com.trolltech.examples.generator.CMapDisplay
>>   protected void __qt_signalInitialization() { __qt_no_notify = true; 
>> __qt_signalInitialization(nativeId()); __qt_no_no
>> tify = false; m_cpp_signals_initialized = true; }
>>
>>              ^
>> I have no reference to MyWidget in my sample scripts/code, is this 
>> hardcoded somewhere?
>
> Yes, GeneratorExample.java is a handwritten file that we ship for 
> testing the generator example, so that part is expected as long as you 
> haven't generated the bindings for the MyWidget class.
>
> The other errors seem to imply that your generated java class is not 
> extending QObject, so this may be a problem with the generator. Could 
> you please check the super class of your CMapDisplay class, both in 
> the C++ and Java implementations?
>
> -- Eskil
>
Start of generated CMapDisplay.java:

"package com.trolltech.examples.generator;
import com.trolltech.qt.*;
public final class CMapDisplay extends com.trolltech.qt.QtObject"


And finally my cpp widged:

class CMapDisplay : public QGLWidget {......

Helge


Message 7 in thread

Hi, Helge.

Helge Fredriksen wrote:

>
> class CMapDisplay : public QGLWidget {......

The QtOpenGL types, such as QGLWidget, are not known to the generator 
unless you import its typesystem in your typesystem specification. I see 
that this is not at all clear from the documentation, so I'll make a 
note of it.

Add the following to your typesystem specification 
(typesystem_mywidget.txt unless you have changed it):

    <load-typesystem name=":/trolltech/generator/typesystem_opengl.txt" 
generate="no" />

Place it after the load-typesystem tag that imports typesystem_gui.txt. 
If you wish to use SQL classes, the same must be done for 
typesystem_sql.txt.

Please note that we are currently working on ways of making the 
generator more user friendly, so any impressions or ideas you have while 
experimenting with it are extremely useful to us, and will be much 
appreciated :-)

-- Eskil


Message 8 in thread

Eskil A. Blomfeldt wrote:
> Hi, Helge.
>
> Helge Fredriksen wrote:
>
> Please note that we are currently working on ways of making the 
> generator more user friendly, so any impressions or ideas you have 
> while experimenting with it are extremely useful to us, and will be 
> much appreciated :-)
>
 No problem as long as you are feedbacking me :-)

I need more help:

I have a public method defined as

void loadArea( QString& mapFile );

which I want to be able to access from my corresponding java class.

The method is generated, but not with QString as argument as expected, 
but with QNativePointer.
How can I make your generator understand my "real" needs?

Helge F.


Message 9 in thread

Hi, Helge.

Helge Fredriksen wrote:

>
> void loadArea( QString& mapFile );
>
> which I want to be able to access from my corresponding java class.
>
> The method is generated, but not with QString as argument as expected, 
> but with QNativePointer.
> How can I make your generator understand my "real" needs?

I am afraid you've found a case we have not implemented in the generator 
yet. Since this function takes a non-const reference to a value type, 
you need to pass in an object of a type which allows both input and 
output. QNativePointer is our general solution for such cases. 
Unfortunately, there is currently no way of converting between 
QNativePointer and strings, so your API can sadly not be completely 
mapped before we fix that problem :-(

If you have the opportunity to alter your C++ API for your experiment, I 
suggest you make it the following:

    QString loadArea(const QString &mapFile)

And then return a new QString containing the altered string instead of 
directly altering the copy which is passed in. In this case, the 
generated Java signature would be:

    String loadArea(String mapFile)

And you would call the function as:

    myString = loadArea(myString)


Or, if you do not need to return anything from the function, then it 
would suffice to alter the C++ signature to:

    void loadArea(const QString &mapFile)

and you will be able to pass a regular java.lang.String as an argument.

Hope this helps!

-- Eskil