Wt in Qt creator



  • hi hat schon jemand Wt unter qt creator zum laufen gebracht und könnte mir helfen?



  • WiWt? = Was ist Wt?



  • Wt == Witty

    http://webtoolkit.eu/wt

    Damit kann man Webseiten mit C++ machen.



  • Warum willst du denn WT mit Qt kombinieren?



  • sryy schrieb:

    hi hat schon jemand Wt unter qt creator zum laufen gebracht und könnte mir helfen?

    Inlcudepfade bekannt machen und libs Dateien einbinden. Das übliche, wie in jeder beliebig anderen IDE auch - auch wenn ich Wt nicht im geringsten kenne.



  • ich hab die libs erstellt und alles includiert und trotzdem krieg ich undefined reference in qt creator k.a warum



  • sryyy schrieb:

    ich hab die libs erstellt und alles includiert und trotzdem krieg ich undefined reference in qt creator k.a warum

    Dann mach eine Minimalbeispiel mit .pro Datei und einer cpp, die das Problem demonstriert.



  • main.cpp

    /*
    * Copyright (C) 2008 Emweb bvba, Heverlee, Belgium.
    *
    * See the LICENSE file for terms of use.
    */
    
    #include <Wt/WApplication>
    #include <Wt/WBreak>
    #include <Wt/WContainerWidget>
    #include <Wt/WLineEdit>
    #include <Wt/WPushButton>
    #include <Wt/WText>
    
    #include <boost/version.hpp>
    
    using namespace Wt;
    
    /*
    * A simple hello world application class which demonstrates how to react
    * to events, read input, and give feed-back.
    */
    class HelloApplication : public WApplication
    {
    public:
      HelloApplication(const WEnvironment& env);
    
    private:
      WLineEdit *nameEdit_;
      WText *greeting_;
    
      void greet();
    };
    
    /*
    * The env argument contains information about the new session, and
    * the initial request. It must be passed to the WApplication
    * constructor so it is typically also an argument for your custom
    * application constructor.
    */
    HelloApplication::HelloApplication(const WEnvironment& env)
      : WApplication(env)
    {
      setTitle("Hello world");                               // application title
    
      root()->addWidget(new WText("Your name, please ? "));  // show some text
      nameEdit_ = new WLineEdit(root());                     // allow text input
      nameEdit_->setFocus();                                 // give focus
    
      WPushButton *b = new WPushButton("Greet me.", root()); // create a button
      b->setMargin(5, Left);                                 // add 5 pixels margin
    
      root()->addWidget(new WBreak());                       // insert a line break
    
      greeting_ = new WText(root());                         // empty text
    
      /*
       * Connect signals with slots
       *
       * - simple Wt-way
       */
      b->clicked().connect(this, &HelloApplication::greet);
    
      /*
       * - using an arbitrary function object (binding values with boost::bind())
       */
      nameEdit_->enterPressed().connect
        (boost::bind(&HelloApplication::greet, this));
    }
    
    void HelloApplication::greet()
    {
      /*
       * Update the text, using text input into the nameEdit_ field.
       */
      greeting_->setText("Hello there, " + nameEdit_->text());
    }
    
    WApplication *createApplication(const WEnvironment& env)
    {
      /*
       * You could read information from the environment to decide whether
       * the user has permission to start a new application
       */
      return new HelloApplication(env);
    }
    
    int main(int argc, char **argv)
    {
      /*
       * Your main method may set up some shared resources, but should then
       * start the server application (FastCGI or httpd) that starts listening
       * for requests, and handles all of the application life cycles.
       *
       * The last argument to WRun specifies the function that will instantiate
       * new application objects. That function is executed when a new user surfs
       * to the Wt application, and after the library has negotiated browser
       * support. The function should return a newly instantiated application
       * object.
       */
      return WRun(argc, argv, &createApplication);
    }
    

    .pro

    #-------------------------------------------------
    #
    # Project created by QtCreator 2010-12-10T12:51:49
    #
    #-------------------------------------------------
    
    QT       += core
    
    QT       -= gui
    
    TARGET = hello
    CONFIG   += console
    CONFIG   -= app_bundle
    
    QMAKE_CXXFLAGS += -DNDEBUG
    
    TEMPLATE = app
    
    INCLUDEPATH += "C:\Programme\WT\include"
    INCLUDEPATH += "C:\Programme\boost\boost_1_44"
    
    LIBS += -LC:/Programme/WT/lib -lwtd -lwtdbod -lwtdbosqlite3d -lwtextd -lwthttpd -lwtisapid
    
    SOURCES += main.cpp
    

    beim compilieren kommt

    undefined reference to Wt::Wapplication::Wapplication(Wt::WEnvironment const)

    und 53 weitere fehler



  • Der Creator kann auch mit cmake umgehen, finde ich um einiges bequemer. Google nach "FindWt.cmake", das bindest du in dein Projekt ein. Damit solltest du keine Linker-Probleme mehr haben.
    qmake ist für die Verwendung von Qt recht schön und bequem, für Non-Qt-Projekte würd ich es aber nicht nehmen, da du Qt unnötigerweise als Abhämgigkeit anziehst und die .pro's auch nicht so flexibel sind (meine Meinung).



  • sryyy schrieb:

    main.cpp

    beim compilieren kommt

    undefined reference to Wt::Wapplication::Wapplication(Wt::WEnvironment const)

    wie sieht denn der Compiler Aufruf dazu aus? Ich vermute, dass deine LIBS += Anweisung so nicht funktioniert.

    Oder es fehlt eine Bibliothek in deiner Liste.



  • g++ -c -DNDEBUG -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\Qt\2010.04\qt\include\QtCore" -I"..\..\..\..\Qt\2010.04\qt\include" -I"..\..\..\..\Programme\WT\include" -I"..\..\..\..\Programme\boost\boost_1_44" -I"..\..\..\..\Qt\2010.04\qt\include\ActiveQt" -I"debug" -I"..\hello" -I"." -I"..\..\..\..\Qt\2010.04\qt\mkspecs\win32-g++" -o debug\main.o ..\hello\main.cpp
    g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-subsystem,console -mthreads -Wl -o debug\hello.exe debug/main.o -L"c:\Qt\2010.04\qt\lib" -LC:/Programme/WT/lib -lwtd -lwtdbod -lwtdbosqlite3d -lwtextd -lwthttpd -lwtisapid -lQtCored4



  • Stell man das einbinden von Qt libs ab (weiß aber aus dem Kopf gerade nicht mehr wie) und binde die wt Bibliotheken mit absolutem Pfad ein.



  • hat irgendwie nichts gebracht :< die libs hab ich it visual studio compiliert und qt creator benutzt mingw könnte das das problem sein?



  • sryyy schrieb:

    hat irgendwie nichts gebracht :< die libs hab ich it visual studio compiliert und qt creator benutzt mingw könnte das das problem sein?

    Natürlich geht das nicht! Die sollten nicht einmal gefunden werden: '.lib' vs '.a' Format.

    Du kannst mit QtCreator aber auch den VS Compiler nutzen. Dafür brauchst du aber auch eine VS-Qt Version - gibt es zum installieren für VS2008.



  • ich will ja von visual studio wegkommen
    also die libs mit mingw nochmal compilieren?



  • sryyy schrieb:

    ich will ja von visual studio wegkommen

    Gibt es auch einen bestimmten vernünftigen Grund ?
    Ausser Microsoft ...

    Gruss Sheldor


  • Mod

    sryyy schrieb:

    ich will ja von visual studio wegkommen
    also die libs mit mingw nochmal compilieren?

    Ja, musst du, wenn du MinGW nutzen willst.



  • Sheldor schrieb:

    sryyy schrieb:

    ich will ja von visual studio wegkommen

    Gibt es auch einen bestimmten vernünftigen Grund ?
    Ausser Microsoft ...

    Gruss Sheldor

    Keiner beißt sich heutzutage noch freiwillig auf eine Plattform fest, warum sich auch selbst so eingrenzen in Zeiten von drei Desktop OS und Pads und Smartphones und was da sonst noch kommen mag.



  • Man kann auch mit VS plattform-unabhängig programmieren. Nur weil ich den Compiler und IDE wechsel, werde ich nicht autom. plattform-unabhängig.



  • qt creator compileirt schneller als visual studio 2008 und öffnet sich viel schneller.

    Außerdem ist das IntelliSense von qt creator geiler



  • Artchi schrieb:

    Man kann auch mit VS plattform-unabhängig programmieren. Nur weil ich den Compiler und IDE wechsel, werde ich nicht autom. plattform-unabhängig.

    Ich kann auch mit einem Feuerstein Feuer machen, ziehe aber ein Feuerzeug vor sorry.


Anmelden zum Antworten