Which compiler should I use to build example code?

8 messages Options
Embed this post
Permalink
Henri De Feraudy

Which compiler should I use to build example code?

Reply Threaded More More options
Print post
Permalink
Hello,
  I'm still trying to get the first sample code to compile and link.
They are here:

https://svn.osgeo.org/qgis/trunk/code_examples/

 
I downloaded version 1.0.2 for windows from here http://qgis.org/en/download/binaries.html
and on that page it's said it's a MSVC build. When I try to build with my Visual C++ express I get the following message at link time.

C:\OSGeo4W\apps\qgis-dev\bin\QGis_core.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x328

Does this mean it was built with GCC?
The compilation guide by Marco Pasetti suggests that we use MinGW.
Are both options quite viable?
yours truly
Henri
 
 

_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Mailing Lists-3

Re: Which compiler should I use to build example code?

Reply Threaded More More options
Print post
Permalink
Hi

Which specific example are you trying to build? You should be able to build with msvc assuming you have LIB_DIR set to an osgeo4w installation the includes all the needed div libs.

Regards

Tim
Sent from my mobile phone.

-----Original Message-----
From: Henri De Feraudy <[hidden email]>
Date: Sat, 31 Oct 2009 12:58:36
To: <[hidden email]>
Subject: [Qgis-developer] Which compiler should I use to build example code?

_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer


_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Mailing Lists-3

Re: Which compiler should I use to build example code?

Reply Threaded More More options
Print post
Permalink
Hi

Please don't write to me off-list. The mailing list is there to share
knowledge and spread workload - sending me messages privately
countermines both goals.

On Sat, Oct 31, 2009 at 10:46 PM, Henri De Feraudy <[hidden email]> wrote:
>
> Thankyou Tim,
> The first example to start with (tutorial 1) . I'd love to be able to continue and make it better, with rectangular selections (I guess that's the rubber band selection example).
>

OK. You need to build it using CMake. Standard procedure should be
(guessing a little because I'm a linux user):

Install osgeo4w into the standard location (c:\osgeo4w) including all
developer libs
Use your system properties to export the LIB_DIR environment var to
point to c:\osgeo4w
enter the tut dir
mkdir build
cd build
cmakesetup ..
configure (c)
generate (g)
nmake

Windows gurus please chip in where I have gone wrong above...


> As for the term div lib, I dont know what you mean. I am handicapped by the fact that I have been out of C & C++ programming for over a decade until a week ago :(.

Sorry that was a typo, I meant dev (ie developer) libs.

I just made some small tweaks to tuts 1-4 so please update from svn
when you get the chance.

Regards

Tim

> As Manuel says in Fawlty Towers "But I'm learning...".
>
> Henri
>
>
> --- On Sat, 10/31/09, Tim Sutton <[hidden email]> wrote:
>
> From: Tim Sutton <[hidden email]>
> Subject: Re: [Qgis-developer] Which compiler should I use to build example code?
> To: "Henri De Feraudy" <[hidden email]>, [hidden email], "QGIS Developer" <[hidden email]>
> Date: Saturday, October 31, 2009, 9:18 PM
>
> Hi
>
> Which specific example are you trying to build? You should be able to build with msvc assuming you have LIB_DIR set to an osgeo4w installation the includes all the needed div libs.
>
> Regards
>
> Tim
> Sent from my mobile phone.
>
> -----Original Message-----
> From: Henri De Feraudy <[hidden email]>
> Date: Sat, 31 Oct 2009 12:58:36
> To: <[hidden email]>
> Subject: [Qgis-developer] Which compiler should I use to build example code?
>
> _______________________________________________
> Qgis-developer mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>



--
Tim Sutton - QGIS Project Steering Committee Member (Release  Manager)
==============================================
Please do not email me off-list with technical
support questions. Using the lists will gain
more exposure for your issues and the knowledge
surrounding your issue will be shared with all.

Visit http://linfiniti.com to find out about:
* QGIS programming and support services
* Mapserver and PostGIS based hosting plans
* FOSS Consulting Services
Skype: timlinux
Irc: timlinux on #qgis at freenode.net
==============================================
_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Henri De Feraudy

Re: Which compiler should I use to build example code?

Reply Threaded More More options
Print post
Permalink
Hello,
  I have installed cmake, read some documentation, checked out the latest timtut1 project and
run cmake, then the Microsoft VS 2008 C++ compiler.
(This is like using a sledge hammer to crack a peanut ;))
 
With eboth Qgis installers I get an error at link time: the linker complains as follows
C:\Program Files\Quantum GIS\bin\qgis_core.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x2F0

(About the same mistake occurs when I use the osgeo release.)
 
By the way the non-osgeo release does not have the includes for GEOS and GDAL
and the names of the libraries for geos and gdal are not the ones that Cmake is looking for.
 
Maybe I should be using a "development library"??
Maybe I should download a more recent (than 1.0.2 Kore) installer?
Yours truly
Henri
 
 
On Sat, Oct 31, 2009 at 10:46 PM, Henri De Feraudy <feraudyh@...> wrote:
>
> Thankyou Tim,
> The first example to start with (tutorial 1) . I'd love to be able to continue and make it better, with rectangular selections (I guess that's the rubber band selection example).
>

OK. You need to build it using CMake. Standard procedure should be
(guessing a little because I'm a linux user):

Install osgeo4w into the standard location (c:\osgeo4w) including all
developer libs
Use your system properties to export the LIB_DIR environment var to
point to c:\osgeo4w
enter the tut dir
mkdir build
cd build
cmakesetup ..
configure (c)
generate (g)
nmake

Windows gurus please chip in where I have gone wrong above...


> As for the term div lib, I dont know what you mean. I am handicapped by the fact that I have been out of C & C++ programming for over a decade until a week ago :(.

Sorry that was a typo, I meant dev (ie developer) libs.

I just made some small tweaks to tuts 1-4 so please update from svn
when you get the chance.

Regards

Tim

> As Manuel says in Fawlty Towers "But I'm learning...".
>
> Henri
>
>
> --- On Sat, 10/31/09, Tim Sutton <lists@...> wrote:
>
> From: Tim Sutton <lists@...>
> Subject: Re: [Qgis-developer] Which compiler should I use to build example code?
> To: "Henri De Feraudy" <feraudyh@...>, qgis-developer-bounces@..., "QGIS Developer" <qgis-developer@...>
> Date: Saturday, October 31, 2009, 9:18 PM
>
> Hi
>
> Which specific example are you trying to build? You should be able to build with msvc assuming you have LIB_DIR set to an osgeo4w installation the includes all the needed div libs.
>
> Regards
>
> Tim
> Sent from my mobile phone.
>
> -----Original Message-----
> From: Henri De Feraudy <feraudyh@...>
> Date: Sat, 31 Oct 2009 12:58:36
> To: <qgis-developer@...>
> Subject: [Qgis-developer] Which compiler should I use to build example code?
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer@...
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>



--
Tim Sutton - QGIS Project Steering Committee Member (Release  Manager)
==============================================
Please do not email me off-list with technical
support questions. Using the lists will gain
more exposure for your issues and the knowledge
surrounding your issue will be shared with all.

Visit http://linfiniti.com to find out about:
* QGIS programming and support services
* Mapserver and PostGIS based hosting plans
* FOSS Consulting Services
Skype: timlinux
Irc: timlinux on #qgis at freenode.net
==============================================

_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Jürgen E. Fischer

Re: Which compiler should I use to build example code?

Reply Threaded More More options
Print post
Permalink
Hi Henri,

On Sun, 01. Nov 2009 at 06:36:50 -0800, Henri De Feraudy wrote:
>    C:\Program Files\Quantum GIS\bin\qgis_core.dll : fatal error LNK1107:
>    invalid or corrupt file: cannot read at 0x2F0
>    (About the same mistake occurs when I use the osgeo release.)

Link with the .lib not with the .dll.

Jürgen
 
--
Jürgen E. Fischer         norBIT GmbH               Tel. +49-4931-918175-20
Dipl.-Inf. (FH)           Rheinstraße 13            Fax. +49-4931-918175-50
Software Engineer         D-26506 Norden               http://www.norbit.de

--
norBIT Gesellschaft fuer Unternehmensberatung und Informationssysteme mbH
Rheinstrasse 13, 26506 Norden
GF: Jelto Buurman, HR: Amtsgericht Emden, HRB 5502

_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Henri De Feraudy

Re: Which compiler should I use to build example code?

Reply Threaded More More options
Print post
Permalink
In reply to this post by Henri De Feraudy
Hi
  I don’t get any visual debugger going but I do get a long trace in a command window.  I wont let that stop me. I have not changed the code yet appart from the obvious path strings .

The last three lines of the trace are
..\..\..\..\..\src\core\qgsmaprenderer.cpp(424) : (QgsMapRenderer::render) Rendering completed in (seconds): 0.203
QApplication::regClass: Registering window class failed. (The class exists already)
QApplication::qAppName: Please instantiate the QApplication object first QWidget: Must construct a QApplication before a QPaintDevice

Henri

--- On Sun, 11/1/09, Mailing Lists <[hidden email]> wrote:

> From: Mailing Lists <[hidden email]>
> Subject: Re: Fw: Re: Fw: Re: [Qgis-developer] Which compiler should I use to  build example code?
> To: "Henri De Feraudy" <[hidden email]>
> Cc: [hidden email]
> Date: Sunday, November 1, 2009, 10:12 PM
> Hi
>
> On Sun, Nov 1, 2009 at 11:01 PM, Henri De Feraudy <[hidden email]>
> wrote:
>
>
> > So, I wonder if the fact that I am using Qt 4.5
> (rather than 4.3) explains the problem
> >
> > program ...\timtut1.exe
> > file: global::qglobal.cpp
> > line 2030
> >
> > QWidget: Must construct a Qapplication before a QPaint
> device.
> >
>
> Try removing the QWidget include in main. But
> probably  you need to
> step through with the debugger to see what is really going
> on.
>
> BTW I wanted to apologise for my previous 'dont email me
> privately
> only' message - my cell phone mail client showed me as the
> only
> recipient but looking at my gmail client I see you had
> indeed sent
> your reply to the list.
>
> Best
>
> Regards
> --
> Tim Sutton - QGIS Project Steering Committee Member
> (Release  Manager)
> ==============================================
> Please do not email me off-list with technical
> support questions. Using the lists will gain
> more exposure for your issues and the knowledge
> surrounding your issue will be shared with all.
>
> Visit http://linfiniti.com to find out about:
>  * QGIS programming and support services
>  * Mapserver and PostGIS based hosting plans
>  * FOSS Consulting Services
> Skype: timlinux
> Irc: timlinux on #qgis at freenode.net
> ==============================================
>
_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Henri De Feraudy

Re: Which compiler should I use to build example code?

Reply Threaded More More options
Print post
Permalink
In reply to this post by Henri De Feraudy
The problem does not go away if I comment out "#include <QWidget>"

--- On Mon, 11/2/09, Henri De Feraudy <[hidden email]> wrote:

> From: Henri De Feraudy <[hidden email]>
> Subject: Re: [Qgis-developer] Which compiler should I use to build example code?
> To: [hidden email]
> Date: Monday, November 2, 2009, 11:14 AM
> Hi
>   I don’t get any visual debugger going but I do get
> a long trace in a command window.  I wont let that stop
> me. I have not changed the code yet appart from the obvious
> path strings .
>
> The last three lines of the trace are
> ..\..\..\..\..\src\core\qgsmaprenderer.cpp(424) :
> (QgsMapRenderer::render) Rendering completed in (seconds):
> 0.203
> QApplication::regClass: Registering window class failed.
> (The class exists already)
> QApplication::qAppName: Please instantiate the QApplication
> object first QWidget: Must construct a QApplication before a
> QPaintDevice
>
> Henri
>
> --- On Sun, 11/1/09, Mailing Lists <[hidden email]>
> wrote:
>
> > From: Mailing Lists <[hidden email]>
> > Subject: Re: Fw: Re: Fw: Re: [Qgis-developer] Which
> compiler should I use to  build example code?
> > To: "Henri De Feraudy" <[hidden email]>
> > Cc: [hidden email]
> > Date: Sunday, November 1, 2009, 10:12 PM
> > Hi
> >
> > On Sun, Nov 1, 2009 at 11:01 PM, Henri De Feraudy
> <[hidden email]>
> > wrote:
> >
> >
> > > So, I wonder if the fact that I am using Qt 4.5
> > (rather than 4.3) explains the problem
> > >
> > > program ...\timtut1.exe
> > > file: global::qglobal.cpp
> > > line 2030
> > >
> > > QWidget: Must construct a Qapplication before a
> QPaint
> > device.
> > >
> >
> > Try removing the QWidget include in main. But
> > probably  you need to
> > step through with the debugger to see what is really
> going
> > on.
> >
> > BTW I wanted to apologise for my previous 'dont email
> me
> > privately
> > only' message - my cell phone mail client showed me as
> the
> > only
> > recipient but looking at my gmail client I see you
> had
> > indeed sent
> > your reply to the list.
> >
> > Best
> >
> > Regards
> > --
> > Tim Sutton - QGIS Project Steering Committee Member
> > (Release  Manager)
> > ==============================================
> > Please do not email me off-list with technical
> > support questions. Using the lists will gain
> > more exposure for your issues and the knowledge
> > surrounding your issue will be shared with all.
> >
> > Visit http://linfiniti.com to find out about:
> >  * QGIS programming and support services
> >  * Mapserver and PostGIS based hosting plans
> >  * FOSS Consulting Services
> > Skype: timlinux
> > Irc: timlinux on #qgis at freenode.net
> > ==============================================
> >
> _______________________________________________
> Qgis-developer mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Henri De Feraudy

Re: Which compiler should I use to build example code?

Reply Threaded More More options
Print post
Permalink
In reply to this post by Henri De Feraudy
I can use my visual C++ environment to see this:
The message is due to a test

if (!qApp) {
        qFatal("QWidget: Must construct a QApplication before a QPaintDevice");
        return;
inside a call to the constructor QWidgetPrivate::QWidgetPrivate(int version). If right mouse-click and I ask for the definition of qApp I get a message saying "resolve ambiguity:" and gives me a choice between
src\corelib\kernel\qcoreapplication.h
and
src\gui\kernel\qapplication.h
(am I right to suspect that this ambiguity is not good?)
anyway the call to QWidgetPrivate::QWidgetPrivate(int version) is inside
a call to
QDesktopWidgetPrivate::QDesktopWidgetPrivate()
inside a call to
QDesktopWidget::QDesktopWidget()
inside a call to
QApplication::desktop()
inside a call to
QGraphicsView::sizeHint()
inside a call to
QWidgetPrivate::adjustedSize()
inside a call to
QWidget::adjustSize()
inside a call to
QWidget::setVisible(bool visible)
inside the call of mypMapCanvas->setVisible(true); in the main

Hope this helps
Henri




--- On Mon, 11/2/09, Henri De Feraudy <[hidden email]> wrote:

> From: Henri De Feraudy <[hidden email]>
> Subject: Re: [Qgis-developer] Which compiler should I use to build example code?
> To: [hidden email]
> Date: Monday, November 2, 2009, 11:24 AM
> The problem does not go away if I
> comment out "#include <QWidget>"
>
> --- On Mon, 11/2/09, Henri De Feraudy <[hidden email]>
> wrote:
>
> > From: Henri De Feraudy <[hidden email]>
> > Subject: Re: [Qgis-developer] Which compiler should I
> use to build example code?
> > To: [hidden email]
> > Date: Monday, November 2, 2009, 11:14 AM
> > Hi
> >   I don’t get any visual debugger going but I do
> get
> > a long trace in a command window.  I wont let that
> stop
> > me. I have not changed the code yet appart from the
> obvious
> > path strings .
> >
> > The last three lines of the trace are
> > ..\..\..\..\..\src\core\qgsmaprenderer.cpp(424) :
> > (QgsMapRenderer::render) Rendering completed in
> (seconds):
> > 0.203
> > QApplication::regClass: Registering window class
> failed.
> > (The class exists already)
> > QApplication::qAppName: Please instantiate the
> QApplication
> > object first QWidget: Must construct a QApplication
> before a
> > QPaintDevice
> >
> > Henri
> >
> > --- On Sun, 11/1/09, Mailing Lists <[hidden email]>
> > wrote:
> >
> > > From: Mailing Lists <[hidden email]>
> > > Subject: Re: Fw: Re: Fw: Re: [Qgis-developer]
> Which
> > compiler should I use to  build example code?
> > > To: "Henri De Feraudy" <[hidden email]>
> > > Cc: [hidden email]
> > > Date: Sunday, November 1, 2009, 10:12 PM
> > > Hi
> > >
> > > On Sun, Nov 1, 2009 at 11:01 PM, Henri De
> Feraudy
> > <[hidden email]>
> > > wrote:
> > >
> > >
> > > > So, I wonder if the fact that I am using Qt
> 4.5
> > > (rather than 4.3) explains the problem
> > > >
> > > > program ...\timtut1.exe
> > > > file: global::qglobal.cpp
> > > > line 2030
> > > >
> > > > QWidget: Must construct a Qapplication
> before a
> > QPaint
> > > device.
> > > >
> > >
> > > Try removing the QWidget include in main. But
> > > probably  you need to
> > > step through with the debugger to see what is
> really
> > going
> > > on.
> > >
> > > BTW I wanted to apologise for my previous 'dont
> email
> > me
> > > privately
> > > only' message - my cell phone mail client showed
> me as
> > the
> > > only
> > > recipient but looking at my gmail client I see
> you
> > had
> > > indeed sent
> > > your reply to the list.
> > >
> > > Best
> > >
> > > Regards
> > > --
> > > Tim Sutton - QGIS Project Steering Committee
> Member
> > > (Release  Manager)
> > > ==============================================
> > > Please do not email me off-list with technical
> > > support questions. Using the lists will gain
> > > more exposure for your issues and the knowledge
> > > surrounding your issue will be shared with all.
> > >
> > > Visit http://linfiniti.com to find out about:
> > >  * QGIS programming and support services
> > >  * Mapserver and PostGIS based hosting plans
> > >  * FOSS Consulting Services
> > > Skype: timlinux
> > > Irc: timlinux on #qgis at freenode.net
> > > ==============================================
> > >
> > _______________________________________________
> > Qgis-developer mailing list
> > [hidden email]
> > http://lists.osgeo.org/mailman/listinfo/qgis-developer
> >
> _______________________________________________
> Qgis-developer mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer