Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 11
  1. #1

    [C++] wxWidgets su Mac OS X

    Ciao a tutti.
    Sto cercando di compilare un programma scritto dal mio professore di informatica che compila su Linux Ubuntu 10.04 su Mac OS X 10.7.4., che utilizza gli include seguenti:
    codice:
    #include "wx/wxprec.h"
    #ifndef WX_PRECOMP
    #include "wx/wx.h"
    #endif
    #include "wx/glcanvas.h" // Pour combiner wxWidgets et OpenGL
    Questo é il mio Makefile:
    codice:
    CC = g++
    CXX = g++
    CXXFLAGS = `wx-config --cxxflags`
    LDLIBS = `wx-config --libs gl,core,base`
    LDLIBS+= -lglut -lGLU -lGL -lXmu -lXi
    
    all: main
    
    main: main.cc
    wxWidgets (per Mac) sembra essere correttamente installato. Ho dovuto utilizzare l'opzione -arch=i386.

    Questi sono gli errori che ottengo. Sembra che OpenGL non funzioni come dovrebbe:
    codice:
    g++ `wx-config --cxxflags`    main.cc  `wx-config --libs gl,core,base` -lglut -lGLU -lGL -lXmu -lXi -o main
    In file included from /opt/local/include/wx-2.8/wx/mac/glcanvas.h:4,
                     from /opt/local/include/wx-2.8/wx/glcanvas.h:60,
                     from main.cc:5:
    /opt/local/include/wx-2.8/wx/mac/carbon/glcanvas.h:49: warning: ‘AGLDrawable’ is deprecated (declared at /System/Library/Frameworks/AGL.framework/Headers/agl.h:47)
    /opt/local/include/wx-2.8/wx/mac/carbon/glcanvas.h:53: warning: ‘AGLDrawable’ is deprecated (declared at /System/Library/Frameworks/AGL.framework/Headers/agl.h:47)
    main.cc: In member function ‘void Vue_OpenGL::dessine(wxPaintEvent&)’:
    main.cc:96: error: ‘gluLookAt’ was not declared in this scope
    main.cc: In member function ‘void Vue_OpenGL::InitOpenGL()’:
    main.cc:170: error: ‘gluPerspective’ was not declared in this scope
    main.cc: In member function ‘virtual bool GUI::OnInit()’:
    main.cc:219: error: ‘SetTopWin’ was not declared in this scope
    main.cc:219: error: expected primary-expression before ‘==’ token
    main.cc:219: error: expected primary-expression before ‘==’ token
    main.cc:219: error: expected primary-expression before ‘==’ token
    main.cc:219: error: expected primary-expression before ‘/’ token
    main.cc:220: error: expected primary-expression before ‘*’ token
    main.cc:220: error: expected `;' before ‘{’ token
    main.cc:220: error: a function-definition is not allowed here before ‘{’ token
    main.cc:220: error: a function-definition is not allowed here before ‘{’ token
    main.cc:220: error: expected `}' at end of input
    make: *** [main] Error 1
    K. L. Thompson
    You can't trust code that you did not totally create yourself.
    A. Bogk
    UNIX is user-friendly, it just chooses its friends.

  2. #2
    Nessuno può aiutarmi?

    Queste librerie sono fatte proprio per essere portabili... Non dovrebbe essere più semplice?!
    K. L. Thompson
    You can't trust code that you did not totally create yourself.
    A. Bogk
    UNIX is user-friendly, it just chooses its friends.

  3. #3
    Originariamente inviato da RooccoXXI
    Nessuno può aiutarmi?

    Queste librerie sono fatte proprio per essere portabili... Non dovrebbe essere più semplice?!
    Ti aiuterei volentieri ma al momento non ho un progetto in corso che usa queste tecnologie.
    Ti invito a cercare i tuoi errori su Google e a provare a chiedere nel forum di WxWidgets.
    Il problema è dovuto al fatto che la versione attuale di WxWidget è a 32 bit, mentre Mac è a 64 bit. Inoltre Mac usa LLVM come compilatore, tra l'altro è stato aggiornato oggi.
    ...

  4. #4
    Originariamente inviato da Caiodark
    Ti aiuterei volentieri ma al momento non ho un progetto in corso che usa queste tecnologie.
    Ti invito a cercare i tuoi errori su Google e a provare a chiedere nel forum di WxWidgets.
    Il problema è dovuto al fatto che la versione attuale di WxWidget è a 32 bit, mentre Mac è a 64 bit. Inoltre Mac usa LLVM come compilatore, tra l'altro è stato aggiornato oggi.
    Ho cercato un po' di qua e un po' di la, ma non ho trovato niente che mi aiutasse davvero. Mi sembra proprio che, malgrado queste librerie siano pensate per essere multipiattaforma, il portino rimanga comunque un'operazione difficile e delicata... =(.

    Non penso che sia obbligatorio che wxWidgets sia a 32 bit, ma l'ho compilato io così perché altrimenti mi dava un'errore (questa soluzione l'ho presa direttamente dal wiki di wxWidgets).

    Il grosso problema é che il mio progetto contiene pesantemente codice C++11 e da quello che ho visto il supporto non é totale con il compilatore di default su Mac. Inoltre non voglio utilizzare Xcode ma un sano Makefile, il che mi costringerebbe ad utilizzare questo compilatore...

    codice:
    i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
    Copyright (C) 2007 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    =(
    K. L. Thompson
    You can't trust code that you did not totally create yourself.
    A. Bogk
    UNIX is user-friendly, it just chooses its friends.

  5. #5
    Utente di HTML.it L'avatar di shodan
    Registrato dal
    Jun 2001
    Messaggi
    2,381
    Prima di lanciarti in avventure col C++11 assicurati che il compilatore supporti quel che stai usando.
    i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1
    secondo questa tabella:
    http://wiki.apache.org/stdcxx/C++0xCompilerSupport

    la versione di G++ che stai usando non supporta niente del C++11
    This code and information is provided "as is" without warranty of any kind, either expressed
    or implied, including but not limited to the implied warranties of merchantability and/or
    fitness for a particular purpose.

  6. #6
    Originariamente inviato da shodan
    Prima di lanciarti in avventure col C++11 assicurati che il compilatore supporti quel che stai usando.

    secondo questa tabella:
    http://wiki.apache.org/stdcxx/C++0xCompilerSupport

    la versione di G++ che stai usando non supporta niente del C++11
    Infatti utilizzo
    codice:
    g++gcc-4.6.x (GCC) 4.6.2
    Copyright (C) 2011 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    perché il compilatore installato con Xcode non supportava il C++11. A quanto pare adesso sembra supportarlo (http://clang.llvm.org/cxx_status.html) e quindi ho aggiornato Xcode e i Command Lines Tools, ma sembra non essere cambiato niente (stessa versione di cui parlavo prima, ossia la 4.2...).

    Il problema é che GCC 4.6 mi serve per il C++11 e a quanto pare GCC 4.2 della Apple é d'obbligo per wxWidgets...

    Forse sto mischiando un po' le cose, scusate. Ricapitolando:
    - Ho un progetto con C++11 e wxWidgets che gira sotto Linux Ubuntu 10.04 compilato con GCC 4.6 ma che non riesco a far andare su Mac (problemi con i compilatori?).
    - Visto il problema precedente ho provato a compilare un programmino (fatto dal mio professore di informatica, anche questo testato su Linux Ubuntu 10.4) con GCC della Apple ma anche questa operazione non é andata a buon fine ed é di questo che parla questa discussione.

    Grazie per le risposte e scusate la conclusione.
    K. L. Thompson
    You can't trust code that you did not totally create yourself.
    A. Bogk
    UNIX is user-friendly, it just chooses its friends.

  7. #7
    Utente di HTML.it L'avatar di shodan
    Registrato dal
    Jun 2001
    Messaggi
    2,381
    Leggendo quella riga avevo capito il contrario.
    Comunque se nemmeno nel forum di wxWidgets ti hanno saputo dire di più, non so se avrai più fortuna qui. Se il G++ di Apple ha introdotto customizzazioni nel compilatore rischi di avere l'apriscatole dentro la scatola che vuoi aprire (un po' come le licenze di Windows insomma ...
    )
    This code and information is provided "as is" without warranty of any kind, either expressed
    or implied, including but not limited to the implied warranties of merchantability and/or
    fitness for a particular purpose.

  8. #8
    io ho installato il gcc 4.7 nel mio mac, supporta molto bene c++11 e come ide NetBeans.
    ...

  9. #9
    Originariamente inviato da Caiodark
    io ho installato il gcc 4.7 nel mio mac, supporta molto bene c++11 e come ide NetBeans.
    Anche GCC 4.6 funziona benissimo e compila tutto quello che ho programmato su Linux con lo stesso compilatore... Ma quando si inizia a parlare di wxWidgets, allora la storia si complica assai. Di IDE preferirei non usarne! ; ). Mi fido di più di un bel Makefile...

    Originariamente inviato da shodan
    Leggendo quella riga avevo capito il contrario.
    Comunque se nemmeno nel forum di wxWidgets ti hanno saputo dire di più, non so se avrai più fortuna qui. Se il G++ di Apple ha introdotto customizzazioni nel compilatore rischi di avere l'apriscatole dentro la scatola che vuoi aprire (un po' come le licenze di Windows insomma ...
    )
    Non credo che abbiano capito il problema...xD

    A quanto pare il compilatore di Apple é clang (LLVM) e non GCC. GCC credo che é installato di default con Xcode per compilare clang. O qualcosa del genere insomma. La nuova versione 3.1 (che ho installato aggiornando Xcode) sembrerebbe supportare C++11. Ho provato allora a modificare il mio Makefile come segue:

    codice:
    CC = clang
    CXX = clang
    CXXFLAGS = `wx-config --cxxflags` -std=c++0x -stdlib=libc++
    LDLIBS = `wx-config --libs gl,core,base`
    LDLIBS+= -lglut -lGLU -lGL -lXmu -lXi
    
    all: main
    
    main: main.cc
    Ma ottengo comunque una sfilza di errori. E io sono abituato a GCC. Ci ho messo un sacco a imparare a leggere gli errori... E adesso mi tocca ricominciare da capo... =(.


    codice:
    clang `wx-config --cxxflags` -std=c++0x -stdlib=libc++    main.cc  `wx-config --libs gl,core,base` -lglut -lGLU -lGL -lXmu -lXi -o main
    In file included from main.cc:5:
    In file included from /opt/local/include/wx-2.8/wx/glcanvas.h:60:
    In file included from /opt/local/include/wx-2.8/wx/mac/glcanvas.h:4:
    /opt/local/include/wx-2.8/wx/mac/carbon/glcanvas.h:49:11: warning: 
          'AGLDrawable' is deprecated [-Wdeprecated-declarations]
       inline AGLDrawable GetDrawable() const { return m_drawable; }
              ^
    /opt/local/include/wx-2.8/wx/mac/carbon/glcanvas.h:53:4: warning: 'AGLDrawable'
          is deprecated [-Wdeprecated-declarations]
       AGLDrawable      m_drawable;
       ^
    main.cc:94:3: error: use of undeclared identifier 'gluLookAt'
      gluLookAt(0.0, 0.0, 7.5,
      ^
    main.cc:170:3: error: use of undeclared identifier 'gluPerspective'
      gluPerspective(65.0, 4./3., 1.0, 1000.0);
      ^
    main.cc:219:3: error: use of undeclared identifier 'SetTopWin'; did you mean
          'SetTopWindow'?
      SetTopWin======== */
      ^~~~~~~~~
      SetTopWindow
    /opt/local/include/wx-2.8/wx/app.h:436:10: note: 'SetTopWindow' declared here
        void SetTopWindow(wxWindow *win) { m_topWindow = win; }
             ^
    main.cc:219:14: error: expected expression
      SetTopWin======== */
                 ^
    main.cc:219:16: error: expected expression
      SetTopWin======== */
                   ^
    main.cc:219:18: error: expected expression
      SetTopWin======== */
                     ^
    main.cc:219:22: error: expected expression
      SetTopWin======== */
                         ^
    main.cc:220:5: error: 'wxAppConsole' does not refer to a value
        IMPLEMENT_APP(GUI)
        ^
    /opt/local/include/wx-2.8/wx/app.h:688:5: note: expanded from macro
          'IMPLEMENT_APP'
        IMPLEMENT_APP_NO_THEMES(appname)        \
        ^
    /opt/local/include/wx-2.8/wx/app.h:682:5: note: expanded from macro
          'IMPLEMENT_APP_NO_THEMES'
        IMPLEMENT_APP_NO_MAIN(appname)          \
        ^
    /opt/local/include/wx-2.8/wx/app.h:668:5: note: expanded from macro
          'IMPLEMENT_APP_NO_MAIN'
        wxAppConsole *wxCreateApp()                                             \
        ^
    /opt/local/include/wx-2.8/wx/app.h:57:24: note: declared here
    class WXDLLIMPEXP_BASE wxAppConsole : public wxEvtHandler
                           ^
    main.cc:220:5: error: expected expression
        IMPLEMENT_APP(GUI)
        ^
    /opt/local/include/wx-2.8/wx/app.h:688:5: note: expanded from macro
          'IMPLEMENT_APP'
        IMPLEMENT_APP_NO_THEMES(appname)        \
        ^
    /opt/local/include/wx-2.8/wx/app.h:682:5: note: expanded from macro
          'IMPLEMENT_APP_NO_THEMES'
        IMPLEMENT_APP_NO_MAIN(appname)          \
        ^
    /opt/local/include/wx-2.8/wx/app.h:677:27: note: expanded from macro
          'IMPLEMENT_APP_NO_MAIN'
        appname& wxGetApp() { return *wx_static_cast(appname*, ...
                              ^
    main.cc:220:5: error: expected ';' at end of declaration
        IMPLEMENT_APP(GUI)
        ^
    /opt/local/include/wx-2.8/wx/app.h:688:5: note: expanded from macro
          'IMPLEMENT_APP'
        IMPLEMENT_APP_NO_THEMES(appname)        \
        ^
    /opt/local/include/wx-2.8/wx/app.h:683:5: note: expanded from macro
          'IMPLEMENT_APP_NO_THEMES'
        IMPLEMENT_WXWIN_MAIN
        ^
    /opt/local/include/wx-2.8/wx/app.h:649:34: note: expanded from macro
          'IMPLEMENT_WXWIN_MAIN'
        #define IMPLEMENT_WXWIN_MAIN IMPLEMENT_WXWIN_MAIN_CONSOLE
                                     ^
    /opt/local/include/wx-2.8/wx/app.h:645:9: note: expanded from macro
          'IMPLEMENT_WXWIN_MAIN_CONSOLE'
            int main(int argc, char **argv) { return wxEntry(argc, argv); }
            ^
    main.cc:220:5: error: expected expression
        IMPLEMENT_APP(GUI)
        ^
    /opt/local/include/wx-2.8/wx/app.h:688:5: note: expanded from macro
          'IMPLEMENT_APP'
        IMPLEMENT_APP_NO_THEMES(appname)        \
        ^
    /opt/local/include/wx-2.8/wx/app.h:683:5: note: expanded from macro
          'IMPLEMENT_APP_NO_THEMES'
        IMPLEMENT_WXWIN_MAIN
        ^
    /opt/local/include/wx-2.8/wx/app.h:649:34: note: expanded from macro
          'IMPLEMENT_WXWIN_MAIN'
        #define IMPLEMENT_WXWIN_MAIN IMPLEMENT_WXWIN_MAIN_CONSOLE
                                     ^
    /opt/local/include/wx-2.8/wx/app.h:645:43: note: expanded from macro
          'IMPLEMENT_WXWIN_MAIN_CONSOLE'
            int main(int argc, char **argv) { return wxEntry(argc, argv); }
                                              ^
    main.cc:220:23: error: expected ';' at end of declaration
        IMPLEMENT_APP(GUI)
                          ^
    main.cc:220:23: error: expected '}'
    main.cc:215:1: note: to match this '{'
    {
    ^
    2 warnings and 13 errors generated.
    make: *** [main] Error 1
    K. L. Thompson
    You can't trust code that you did not totally create yourself.
    A. Bogk
    UNIX is user-friendly, it just chooses its friends.

  10. #10
    Utente di HTML.it L'avatar di shodan
    Registrato dal
    Jun 2001
    Messaggi
    2,381
    A questo punto io cercherei con google wxWidgets + clang.
    Il primo link è questo. Vedi se ti è utile.
    http://trac.wxwidgets.org/ticket/12332
    This code and information is provided "as is" without warranty of any kind, either expressed
    or implied, including but not limited to the implied warranties of merchantability and/or
    fitness for a particular purpose.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.