Results 1 to 1 of 1

Thread: Compile problem when using QXmlSchema with Ubuntu 11.04

  1. #1
    Join Date
    Sep 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Compile problem when using QXmlSchema with Ubuntu 11.04

    Hi,

    Not sure if this is a newbie question or not, but I can't get the example code from

    http://qt.developpez.com/doc/4.7/qxmlschema/

    to work. My minimum test case is

    //

    Qt Code:
    1. #include <QXmlSchema>
    2.  
    3. QUrl schemaUrl("file:///home/mark/adversity/stylesheets/ttl_stylesheets.xsd");
    4.  
    5. QXmlSchema schema;
    6. schema.load(schemaUrl);
    To copy to clipboard, switch view to plain text mode 

    //

    My .pro file is

    //

    Qt Code:
    1. TEMPLATE = app
    2. TARGET =
    3. DEPENDPATH += .
    4. INCLUDEPATH += .
    5.  
    6. QT += xmlpatterns
    7.  
    8. # Input
    9. SOURCES += main.cpp
    To copy to clipboard, switch view to plain text mode 

    //

    When I try to compile this with Ubuntu 11.04 (which appears to be QT 4.7.2) I get

    ##

    Qt Code:
    1. $ make
    2. g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_XMLPATTERNS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtXmlPatterns -I/usr/include/qt4 -I. -I. -o main.o main.cpp
    3. main.cpp:6:1: error: ‘schema’ does not name a type
    4. make: *** [main.o] Erreur 1
    To copy to clipboard, switch view to plain text mode 

    ##

    The thing I really don't understand is why, if there's a compiling problem, it isn't flagged on line 5, ie

    Qt Code:
    1. QXmlSchema schema;
    To copy to clipboard, switch view to plain text mode 

    If that line compiles correctly, I can't see why 'schema' in

    Qt Code:
    1. schema.load(schemaUrl);
    To copy to clipboard, switch view to plain text mode 

    does not name a type.

    I've compiled several other fairly substantial QT programs in this environment, including one using SAX, so the problem appears to be quite specific.

    All suggestions gratefully received...

    (Obviously my code is missing a main(), but the compiler isn't getting far enough for that to be an issue...)


    Added after 13 minutes:


    (Although, obviously, not wrapping the code within a function definition changes the context, and if I do that it does compile. Oh well...)
    Last edited by mvahowe; 21st September 2011 at 15:38.

Similar Threads

  1. installation problem of qt in ubuntu 10.10
    By sachinmcajnu in forum Newbie
    Replies: 1
    Last Post: 12th April 2011, 16:50
  2. Qt Creator Problem with Ubuntu 10.04
    By Hany in forum Qt Tools
    Replies: 1
    Last Post: 8th June 2010, 12:26
  3. Can't Compile on Ubuntu Linux
    By mpauley in forum Newbie
    Replies: 6
    Last Post: 9th April 2010, 22:00
  4. QXmlSchema, XSD Schema validation problems
    By UVV in forum Qt Programming
    Replies: 0
    Last Post: 2nd February 2010, 11:44
  5. Compile error with qtopia-opensrouce-4.3.2 on Ubuntu.
    By JPPoulin in forum Qt Programming
    Replies: 0
    Last Post: 6th June 2009, 03:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.