Results 1 to 3 of 3

Thread: Different behaviour building on Linux and Windows.

  1. #1
    Join Date
    May 2009
    Location
    Sweden
    Posts
    14
    Thanks
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Different behaviour building on Linux and Windows.

    I am using a SQLite database in a Qt app and it works fine building on both windows and linux. Running it from Qt Creator works fine on both machines but if I execute the binary directly it doesn't find the database on linux but does on windows.

    Qt Code:
    1. QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
    2. db.setDatabaseName("db/database.sqlite");
    To copy to clipboard, switch view to plain text mode 

    Also, when I build on windows the binary is located at <projectdir>/debug or <projectdir>/release depending on which build config I use but on Linux it's always located at <projectdir>.

    Why is it like that? Shouldn't Qt Creator handle paths relative to the project in the same manner on both platforms?

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Different behaviour building on Linux and Windows.

    Quote Originally Posted by newstead View Post
    Why is it like that? Shouldn't Qt Creator handle paths relative to the project in the same manner on both platforms?
    No, the path is defined by your used OS. And this is also the reason why your database once get found and other time not. That's the disadvantage of relativ paths...

    Have a look at the wiki: Current working directory

  3. The following user says thank you to Lykurg for this useful post:

    newstead (4th June 2009)

  4. #3
    Join Date
    May 2009
    Location
    Sweden
    Posts
    14
    Thanks
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Different behaviour building on Linux and Windows.

    Okay, I get that. But still, why doesn't Creator work with debug and release directorys on Linux when it does on Windows? It would be convienient if the tool had the same behaviour on different platforms...

Similar Threads

  1. Replies: 5
    Last Post: 15th January 2009, 10:03
  2. QGraphicsView on Linux vs. Windows
    By awestman in forum Qt Programming
    Replies: 1
    Last Post: 17th September 2008, 22:50
  3. QPalette works differently on windows and linux
    By babu198649 in forum Newbie
    Replies: 3
    Last Post: 6th March 2008, 08:27
  4. Replies: 19
    Last Post: 21st January 2008, 10:13
  5. Replies: 4
    Last Post: 12th January 2006, 05:16

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.