IPB

Bienvenue invité ( Connexion | Inscription )

 
Reply to this topicStart new topic
> problème pour installer SDL sur Xcode
Options
thomazzzl
posté 8 Feb 2006, 23:01
Message #1


Nouveau Membre


Groupe : Membres
Messages : 32
Inscrit : 14 Aug 2005
Membre no 43 883



bonjour,
je possède Tiger,
et j'essaye d'installer la librairie SDL sur Xcode, et j'avoue ne pas du tout savoir comment faire...
j'ai téléchargé SDL 1.2.9, et j'ai mis le /SDL.framework dans /Library/Frameworks comme indiqué quand le reasme.txt

CITATION
To Install:
Copy the SDL.framework to /Library/Frameworks


et après ?

merci d'avance wink.gif
Go to the top of the page
 
+Quote Post
schlum
posté 8 Feb 2006, 23:21
Message #2


Terminaltor
Moderating Machine
*****

Groupe : Admin
Messages : 24 449
Inscrit : 25 Oct 2002
Lieu : Jeumont (59)
Membre no 4 319



Ben après si tu veux l'utiliser dans un projet Xcode, il suffit d'ajouter le framework au projet...


--------------------
          I think therefore I Mac          
Go to the top of the page
 
+Quote Post
ntx
posté 9 Feb 2006, 08:25
Message #3


Macbidouilleur d'Or !
*****

Groupe : Membres
Messages : 2 490
Inscrit : 19 Aug 2004
Lieu : 92
Membre no 22 254



Et la fin du readme ? biggrin.gif
CODE

- Using the Project Stationary
    Copy the stationary to the indicated folders to access it from
    the "New Project" and "Add target" menus. What could be easier?

- Setting up a new project by hand
    Some of you won't want to use the Stationary so I'll give some tips:
    * Create a new "Cocoa Application"
    * Add src/main/macosx/SDLMain.m , .h and .nib to your project
    * Remove "main.c" from your project
    * Remove "MainMenu.nib" from your project
    * Add "$(HOME)/Library/Frameworks/SDL.framework/Headers" to include path
    * Add "$(HOME)/Library/Frameworks" to the frameworks search path
    * Add "-framework SDL -framework Foundation -framework AppKit" to "OTHER_LDFLAGS"
    * Set the "Main Nib File" under "Application Settings" to "SDLMain.nib"
    * Add your files
    * Clean and build

- Building from command line
    Use pbxbuild in the same directory as your .pbproj file
        
- Running your app
    You can send command line args to your app by either invoking it from
    the command line (in *.app/Contents/MacOS) or by entering them in the
    "Executibles" panel of the target settings.
    
- Implementation Notes
    Some things that may be of interest about how it all works...
    * Working directory
        As defined in the SDL_main.m file, the working directory of your SDL app
        is by default set to its parent. You may wish to change this to better
        suit your needs.
    * You have a Cocoa App!
        Your SDL app is essentially a Cocoa application. When your app
        starts up and the libraries finish loading, a Cocoa procedure is called,
        which sets up the working directory and calls your main() method.
        You are free to modify your Cocoa app with generally no consequence
        to SDL. You cannot, however, easily change the SDL window itself.
        Functionality may be added in the future to help this.
Go to the top of the page
 
+Quote Post
thomazzzl
posté 9 Feb 2006, 11:49
Message #4


Nouveau Membre


Groupe : Membres
Messages : 32
Inscrit : 14 Aug 2005
Membre no 43 883



hello,
merci pour vos réponses.

schlum, c'est fait, mais j'ai encore qq petite soucis confused5.gif


ntx, j'ai verifié, a j'ai rien de tout ca dans mon readme tongue.gif


donc pour la suite de mon pb :
(deja, il faut savoir que je suis complètement débutant la dedans... je viens juste de commencer a apprendre le C/C++. pourquoi je veux SDL alors ? pour voir les projet d'un pote ^^')
oui donc, j'ai crée un nouveau projet, j'ajoute SDL.framework au projet, ce qui donne ca :

Image IPB

je sais pas si il fallait faire ca, mais je l'ai fait : j'ai déplacé le SDL.framework et je l'ai renommé, ce qui a donné ca :

Image IPB

et enfin, plus d'erreurs dans mon code que je met : #include <SDL.h> biggrin.gif
part contre, des que je compile le tout, (avec un code très simple pour l'exemple), bah sa me met un erreur dans la console :

Image IPB

alors, ou est ce que j'ai fait une bétise ? ^^'
merci d'av wink.gif

Ce message a été modifié par thomazzzl - 9 Feb 2006, 11:50.
Go to the top of the page
 
+Quote Post
schlum
posté 9 Feb 2006, 11:57
Message #5


Terminaltor
Moderating Machine
*****

Groupe : Admin
Messages : 24 449
Inscrit : 25 Oct 2002
Lieu : Jeumont (59)
Membre no 4 319



Non, il ne fallait surtout pas renommer le framework...
Par contre, transformer les "#include <SDL.h>" en "#include <SDL/SDL.h>" !


--------------------
          I think therefore I Mac          
Go to the top of the page
 
+Quote Post
thomazzzl
posté 9 Feb 2006, 12:38
Message #6


Nouveau Membre


Groupe : Membres
Messages : 32
Inscrit : 14 Aug 2005
Membre no 43 883



erf...
merci wink.gif
j'ai donc remis comme il fallait :

Image IPB

pourtant, j'ai toujours ca :

Image IPB

alors ? sad.gif
Go to the top of the page
 
+Quote Post
schlum
posté 9 Feb 2006, 13:16
Message #7


Terminaltor
Moderating Machine
*****

Groupe : Admin
Messages : 24 449
Inscrit : 25 Oct 2002
Lieu : Jeumont (59)
Membre no 4 319



Tu as bien ajouté le framework avec la fonction "Project" -> "Add to Project..." de xCode ?
Faudrait voir avec le débuggeur où il plante...


--------------------
          I think therefore I Mac          
Go to the top of the page
 
+Quote Post
ntx
posté 9 Feb 2006, 19:38
Message #8


Macbidouilleur d'Or !
*****

Groupe : Membres
Messages : 2 490
Inscrit : 19 Aug 2004
Lieu : 92
Membre no 22 254



Il manque quelques petites choses. Extrait de la FAQ de SDL :
CODE

Q:    What is SDLMain.m? Do I need it? Why is _main undefined?
A:    Just like main() is the entry point for C programs (inc. C++, Objective-C, and Objective-C++), SDL_main() is the main entry point for SDL programs. However, you don't actually write an SDL_main() function. The header file "SDL_main.h" remaps your main() function to the SDL_main() function with a function macro. Your SDL_main() function is called after the code in SDLMain.m has performed the required "bootstrap" initializations to support the SDL runtime.

There are three things you have to do:
You must include either SDLMain.m/.h or libSDLmain in your application, because this is the code that defines SDL's entry point. If you fail to do this, it is likely that "_main undefined" will be thrown by the linker.
You must give your main() procedure the following prototype:
int main(int argc, char*argv[]);
You must make sure the file containing your main() procedure #includes SDL.h.
Otherwise, the macro will not remap main() to SDL_main(), you will get an undefined _main error, or the bootstrap process will not run, and SDL will behave strangely or your application will crash or hang.
Q:    Is there a way to avoid SDLMain.m and Objective-C in my program? I want a pure C/C++ program.
A:    If you are using ProjectBuilder or XCode, then the answer is no. SDLMain.m must be included in your application, which requires Cocoa/Objective-C.

You can still write your SDL application in C++. The easiest way to get started with this is to rename "main.c" in the project stationary to "main.cpp" and recompile your application.

If you are developing using the UNIX variant of SDL, you can link libSDLmain.a into your application, which simply contains a precompile version of SDLmain.m.

So for command-line/Makefile builds, just add -lSDLmain to your build commands like any other library and add "-framework Cocoa" to the gcc or ld flags. Better yet, use the sdl-config script (in the source code distribution) which computes the correct compiler and linker flags for you.
Go to the top of the page
 
+Quote Post
thomazzzl
posté 9 Feb 2006, 20:52
Message #9


Nouveau Membre


Groupe : Membres
Messages : 32
Inscrit : 14 Aug 2005
Membre no 43 883



encore merci pour vos réponses.

schlum, oui j'ai bien fait comme tu a dit. je viens de refaire un nouveau projet au cas ou, et toujours le même problème...

et avec ce code :
CODE
#include <stdio.h>
#include <stdlib.h>
#include <SDL/SDL.h>

int main (int argc, char * const argv[])
{
    printf("Hello, World!\n");
    return 0;
}

voila ce que ca me donne avec le debugger :

Image IPB

Image IPB

ntx, en plus d'étre nul pour installer SDL, je suis aussi nul en anglais unsure.gif
Go to the top of the page
 
+Quote Post
ntx
posté 9 Feb 2006, 21:46
Message #10


Macbidouilleur d'Or !
*****

Groupe : Membres
Messages : 2 490
Inscrit : 19 Aug 2004
Lieu : 92
Membre no 22 254



Je suppose que tu as téléchargé SDL-1.2.9.dmg ? Si oui, dans ce package, il y a un répertoire "devel-lite" où tu trouveras les fichiers "SDLMain.h" et "SDLMain.m". Copies ces fichiers dans le répertoire de ton projet et ajoutes les au projet dans XCode.

PS : tu peux aussi téléchargé le fichier "SDL-devel-1.2.9.pkg.tar.gz" qui te permet d'installer de nouveaux templates pour XCode afin de faire des applications SDL.

Ce message a été modifié par ntx - 9 Feb 2006, 21:52.
Go to the top of the page
 
+Quote Post
thomazzzl
posté 9 Feb 2006, 22:12
Message #11


Nouveau Membre


Groupe : Membres
Messages : 32
Inscrit : 14 Aug 2005
Membre no 43 883



ntx, j'ai fait comme tu as dit :

Image IPB

et quand je compile mon code (le même que dans le message d'avant), il trouve 5 erreurs dans le fichier SDLMain.m

Image IPB

apparemment, c'est du au #import "SDL.h" dans SDLmain.m, je le modifie en #import "SDL/SDL.h"
et quand je compile, cette fois ca me donne ca :

Image IPB

que faire ? sad.gif
Go to the top of the page
 
+Quote Post
ntx
posté 9 Feb 2006, 23:16
Message #12


Macbidouilleur d'Or !
*****

Groupe : Membres
Messages : 2 490
Inscrit : 19 Aug 2004
Lieu : 92
Membre no 22 254



Si tu ne veux pas y passer la nuit : installes les templates SDL pour XCode avec "SDL-devel-1.2.9.pkg.tar.gz" et recréer un projet du type "SDLApplication". Ajoutes y le framework SDL et modifies les includes, normalement ça devrait marcher.

PS : pour ton problème de zerolink, édite ta cible, dans l'onglet "Build", décoche l'option "zerolink".

Ce message a été modifié par ntx - 9 Feb 2006, 23:18.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 utilisateur(s) sur ce sujet (1 invité(s) et 0 utilisateur(s) anonyme(s))
0 membre(s) :

 



Nous sommes le : 28th April 2024 - 13:01