Contents [hide] 1 Creating a project from scratch using Visual Studio (any version) 1.1 Download and install Bullet 1.2 Download and install cmake 1.3 Run CMake-gui 1.4 Create a new Visual Studio project 1.4.1 Alternative,manual method 2 Creating a project from scratch using XCode 3 Unix,Linux,MinGW etc 4 Link order for libraries |
If you do not want to use cmake,here is another simple method. Assuming you have unzipped Bullet in C:\bullet-2.75\,adjust all pathnames if necessary:
Create a new,empty C++ project (file > New > Project: Choose Project types > Visual C++ > General > Empty Project) Add a new C++ file (e.g. "main.cpp") to your project and copy the code from the Hello World page into it and save it. Open the propertIEs of your project (in the Solution Explorer right-click the project name and select PropertIEs,or in the Property Manager double-click DeBUG|Win32): In Configuration PropertIEs > C/C++ > General > Additional Include DirectorIEs add:highlight: UnkNown source file extension "dos".
You need to specify a language like this: <source lang="HTML">...</source>
Supported languages for Syntax highlighting:
4gl,a4c,abp, ada,agda,ampl,amtrix,applescript,arc,arm,as,asm,asp,aspect,au3,avenue,awk, bat,bb,bib,bms,boo,c,cb,cfc,clipper,clp,cob,cs,CSS,d,diff,dot,dylan,e,erl,euphoria,exp,f77,f90,flx,frink,haskell,hcl,httpd,icn, IDl,ini,inp,io,j, java,Js,Jsp,lbn,ldif,lgt,lisp,lotos,ls,lsl,lua,ly,m,make,mel,mib,miranda,ml,mo,mod3,mpl,ms,mssql,n,nas,nice,nsi,nut,oberon, objc,octave,@R_250_5403@,os,pas,PHP,pike,pl,pl1,pov,pro,progress,ps,ps1, psl,py,pyx,q,qu, r,rb,rexx,rnc,s, sas,sc,scala,scilab,sh,sma,smalltalk,sml,snobol, spec,spn,sql,sybase,tcl,tcsh,test_re,tex,ttcn3, txt,vb,verilog,vhd,xml,xpp,y
Recursively add all .cpp files from the Bullet/src folder to your project Build and deBUG your project. @H_403_42@Creating a project from scratch using XCodeAssume we downloaded bullet-2.x.tgz and unzipped it into a folder /Users/name/develop,we will have for example: /Users/name/develop/bullet-2.76
Create a new C++ console application,using XCode:"btTypedConstraint::serialize(voID*,btSerializer*) const",referenced from:
"btAlignedFreeInternal(voID*)",referenced from:
then you have to include the Bullet frameworks in your Xcode project. Make sure they are built and installed like this (This is without Xcode,maybe there is some way to make them in Xcode too,I don't kNow):
cmake . -G "Unix Makefiles" -DINSTALL_liBS=ON -DBUILD_SHARED_liBS=ON \ -DFRAMEWORK=ON -DCMAKE_OSX_ARCHITECTURES='i386;x86_64' \ -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/library/Frameworks \ -DCMAKE_INSTALL_name_DIR=/library/Frameworks -DBUILD_DEMOS:BOol=OFF make -j4 sudo make install
This will put the Bullet frameworks in /library/Frameworks. Navigate there in the finder and then drag the frameworks into your Xcode project. You need at least linearMath.framework and BulletDynamics.framework. (Those two will fix the above linking errors.) But you probably also want BulletCollision.framework and maybe others.
If you have set up the frameworks like this,you don't have to change the header search path as above. Instead you can put this include line and Xcode will find the headers insIDe the framework:
#include <BulletDynamics/btBulletDynamicsCommon.h>From here,continue to the Hello World tutorial. @H_403_42@Unix,MinGW etc
Follow the generic make recipe from the installation guIDe making sure the .a files are built. From there,when creating a Makefile,in the gcc arguments,make sure you add in a -I bullet_dir for the headers and also add in libBulletDynamics.a,libBulletCollision.a and liblinearMath.a or whatever you're using.
For example (assuming the src dir is in the folder bullet):
gcc myprogram.cpp -lGL -lglu -I ./bullet/ ./bullet/BulletDynamics/libBulletDynamics.a ./bullet/BulletCollision/libBulletCollision.a ./bullet/linearMath/liblinearMath.a@H_403_42@link order for librarIEs
Note that many compilers the link order matters,so make sure to use the following order of librarIEs:
BulletMultiThreaded (optional) MiniCL (optional) BulletWorldimporter (optional) BulletSoftbody (optional) BulletDynamics BulletCollision linearMath Category: Getting started 总结以上是内存溢出为你收集整理的Bullet cocos2d-x Creating a project from scratch全部内容,希望文章能够帮你解决Bullet cocos2d-x Creating a project from scratch所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)