Skip to main content
History: Building From Source - Windows - Shoggoth
View published page
Source of version: 40
(current)
%prevogre% {maketoc showhide="y"} !!MS Visual C++ !!!Prerequisites !!!!Development Environment Specific Dependencies {VERSIONS(nav="y",default="Visual Studio 2008 [[VC9]")} The Ogre team offers full support for Visual C++ 2008 (all editions including Express). {DIV(class="Layout_box4")}%warning2% You need to install Service Pack 1 for Visual Studio 2008 - and the ATL security fix as well (available through Microsoft Update).{DIV} __Dependencies__ The precompiled dependencies is available [http://downloads.sourceforge.net/ogre/OgreDependencies_VC9_Eihort_20080203.zip|here]. The dependencies work with both the current stable branch (Shoggoth, or 1.6) as well as SVN HEAD (Ogre 1.7 a.k.a. Cthugha). ---(Visual Studio 2005 [[VC8])--- All editions (Express, Standard, Professional, Team Studio), including "student" and "academic", of Visual C++ 2005 (with Service Pack 1) are supported directly by the Ogre Project Team. {DIV(class="Layout_box4")}%warning2% You will need to install Service Pack 1 for the edition of Visual Studio/Visual C++ 2005 that you are using. The reason that you need this even for the source, is that the Dependencies are built against VC8 SP1, and you very likely will encounter errors trying to run apps built against the VC8 SP1 Dependencies, in Visual C++ without Service Pack 1. You will know whether you installed Service Pack 1 or not " it's a 400MB download and takes up to 45 minutes to patch Visual Studio (depending on how many parts of Visual Studio 2005 you have installed).{DIV} {REMARKSBOX(type="warning",highlight="y",close="n")}If you are using __Visual C++ Express 2005 (vc 8.0) for the first time, make sure you do all 5 steps [http://www.microsoft.com/express/2005/platformsdk/default.aspx|here] prior to building Ogre with VC8 SP1.{REMARKSBOX} Visual C++ Express 2005 does not come with the windows headers and libraries so the second step in that MSDN link is to download the Microsoft Platfrom SDK (PSDK) which has what Express does not. If you don't install the PSDK and do steps 3, 4, and 5 then you will get compiler errors like can't find 'windows.h' etc. Yes, the PSDK is a mother"load of a download but hey its free :). An alternative to reading the above psdk installation guide is to visit [http://msdn.microsoft.com/vstudio/express/visualc/learning/|Visual C++ 2005 Express Learning Resources] and scroll down to the videos. Choose to view this one: ''Using Visual C++ Express Edition and the Platform SDK''. __Dependencies__ You will need the Visual C++ 2005 (SP1) Dependencies package for Shoggoth (Ogre 1.6.x), available from the Ogre Downloads page [http://downloads.sourceforge.net/ogre/OgreDependencies_VC8SP1_Eihort_20071227.zip|here]. Unzip the full ZIP file directly into "+ogre/+" (or whatever you called the directory containing your Ogre source code), so that you have a new folder called "+Dependencies+" at the same level as "+Samples+", "+OgreMain+", and so on. The Visual C++ 2005 SP1 Dependencies (all editions including Express, academic and student) work with both the current stable branch (Shoggoth, or 1.6) as well as SVN HEAD (Cthugha, or 1.7/1.8). __Platform SDK:__ For users of the free VC++ 2005 Express edition, you'll need to install the monolithic (~400Mb) [http://www.microsoft.com/downloads/details.aspx?FamilyId=A55B6B43"E24F"4EA3"A93E"40C0EC4F68E5&displaylang=enMicrosoft|Platform SDK (PSDK)]. __If you are using Visual C++ Express 2008, you can skip ahead to the section titled ''Building''.__ For those with restricted bandwidth, the PSDK is available on CD for a nominal fee. After installing the PSDK, start VC++ 2005 Express and: * From the main menu, open the Tools|Options dialog. In the Projects and Solutions section, select VC++ Directories and, by browsing your local disk rather than manually typing, add the following paths: ** In the 'Executable files' list, C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin ** In the 'Include files' list, C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\include ** In the 'Library files' list, C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\lib * With a text editor, edit the file C:\Program Files\Microsoft Visual Studio 8\VC\VCProjectDefaults\corewin_express.vsprops and change the string that reads, {MONO()}AdditionalDependencies="kernel32.lib"{MONO} to {MONO()}AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib"{MONO} * In Visual C++ Express, the Win32 Windows Application type is disabled in the Win32 Application Wizard. To enable that type, you need to edit the file AppSettings.htm file located in the folder "{MONO()}%ProgramFiles%\Microsoft Visual Studio 8\VC\VCWizards\AppWiz\Generic\Application\html\1033\{MONO}". In a text editor comment out lines 441 - 444 by putting a {MONO()}//{MONO} in front of them as shown here: {CODE(wrap="1")} // WIN_APP.disabled = true; // WIN_APP_LABEL.disabled = true; // DLL_APP.disabled = true; // DLL_APP_LABEL.disabled = true; {CODE} * Finally, close and restart VC++ 2005 Express. If you don't follow these instructions exactly, you are likely to see compile and link problems. More specifically, expect to see copious errors complaining about missing 'windows.h' and 'user32.lib' files. (These instructions are lifted from Microsoft's notes on [http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/default.aspx|using Express with the PSDK].) Note: If you are running Windows Vista you'll have to look for "Microsoft Windows SDK" instead of the PSDK. It was renamed after the release of Windows Vista. A current download can be found at [http://www.microsoft.com/downloads/details.aspx?familyid=4377F86D"C913"4B5C"B87E"EF72E5B4E065|the microsoft website]. ---(Visual Studio 2003 [[VC7.1])--- All editions of Visual C++.NET 2003, including "student" and "academic", are supported directly by the Ogre Project Team. __Dependencies__ You will need the Visual C++.NET 2003 Dependencies package for Shoggoth (Ogre 1.6.x), available from the Ogre Downloads page [http://downloads.sourceforge.net/ogre/OgreDependencies_VC71SP1_Eihort_20071227.zip|here]. Unzip the full ZIP file directly into ''ogre/'' (or whatever you called the directory containing your Ogre source code), so that you have a new folder called "Dependencies" at the same level as "Samples", "OgreMain", and so on. The Visual C++.NET 2003 Dependencies (all editions including Express, academic and student) work with both the current stable branch (Eihort, or 1.4) as well as CVS HEAD (Shoggoth, or 1.5/1.6). ---(Older)--- __These versions are no longer supported.__ Please do not ask in the forums how to have them supported; the compilers in these versions are hopelessly broken, and Microsoft is falling over itself to give you current, modern versions of their Visual Studio IDE and compilers for free. Please [http://www.microsoft.com/express/vc/|download and install] the latest Visual C++ Express Edition, and follow the instructions for that edition. {VERSIONS} !!!!DirectX SDK Download the latest DirectX 9.0 SDK from [http://msdn.microsoft.com/directx]. The DirectX SDK install should automatically update the Visual Studio include and library paths with the locations of the DX SDK includes and lib paths. If not, you will need to enter the DirectX include and library directories into MSVC so you can compile against the SDK. It would look something like this: * Select {MONO()}Tools|Options|Projects|VC++ Directories{MONO} {DIV(class="Layout_box4")}%info% Path to the folder must be ON TOP of the list or you will get errors during compilation (Example: error LNK2001: unresolved external symbol _IID_IDirect3DBaseTexture9){DIV} * Under library files, set the appropriate library directory for the SDK. E.g., {MONO()}C:\Program Files\Microsoft DirectX SDK (August 2007)\Lib\x86 {MONO} * Under include files, set the appropriate include directory for the SDK. E.g., {MONO()}C:\Program Files\Microsoft DirectX SDK (August 2007)\Include{MONO} !!!!Ogre Source * Go to [http://www.ogre3d.org] and select, ''More Downloads'', then ''Source: Windows''. Alternately, you can get the source from SVN, using the instructions at [http://www.ogre3d.org/index.php?option=com_content&task=view&id=415&Itemid=144]. The current stable branch is titled "+v1"6+". * Extract the Ogre source (if you downloaded a source tarball). * Regardless of how you obtained the source, you will then need to extract the Dependencies inside the ''ogre'' folder (so that you end up with an ogre/Dependencies folder). If for whatever reason you want to build dependencies yourself (e.g. you're using the unstable version and precompiled dependencies aren't available), see the ((BuildingDependencies|Building Dependencies)) page. !!!Building With the prerequisites installed, we are ready to build OGRE. * Open the ogre\ogre.sln file (ogre\Ogre_vc8.sln for VC++ 2005 and VC++ 2008, all editions; VC++ 2008 will convert the solution and projects for you) * Click "build all". The build process takes around 15 minutes on a modern P4 class system. If all goes well, the engine, plugins, tools, and demos will build. Next, try running the demos to verify everything worked. They are found in __ogre\Samples\Common\bin\Debug__ (or bin\Release if built in release mode). !!!Project Setup If you are using VC++ .NET 2003 or later, you can use the [http://www.jacmoe.dk/forum/index.php?board=4.0|Ogre Application Wizard] and you are ready to create OGRE apps. See also ((The Complete Blanks Guide To Using The OGRE SDK AppWizard - Shoggoth)). If you feel like setting up a project manually, here''s how:'' Provided with OGRE is a subclassable ExampleApplication class (found in ogre\Samples\Common\include, just for future reference), which will allow you to develop applications very quickly using a fairly standard set of parameters. While OGRE will allow you to build most any kind of application you wish, the ExampleApplication will provide you with a good base for the majority of 3D applications, and is even suitable for building production-level apps off of. We'll start by setting up a new Visual C++ Win32 project. Make sure that "Empty Project" is checked in the application settings. I like to create my smaller projects in the ogre\Samples directory, simply for consistency's sake. You can put them wherever you like, however. Once you have your project, the first thing you're going to want to do is set up your project properties to use OGRE. There is a tutorial on doing this here ([http://www.ogre3d.org/wiki/index.php/SettingUpAnApplication)]. The tutorial will also walk you through the basics of setting up an app, so feel free to browse through it. However, if you just want the quick rundown, here's what you'll need to do: * Right-click the project name in the solution explorer and select "Properties". * Add the ogre\OgreMain\include and ogre\Samples\Common\include directories to your "additional includes" directory (Found under C++/General). Visual Studio requires you to create a .cpp or .h file for the C++ options to show up. * Add ogre\OgreMain\lib\(Debug|Release) to your "library search paths" field (found under Linker/General) * Add OgreMain.lib to the "Additional Dependencies" field (found under Linker/Input) (Note - if you've downloaded the libraries from the Ogre website and are using the Debug ones you will need to make this OgreMain_d.lib -- not adding the _d will cause ~4 perplexing linker errors. Hope this helps anyone in need. --lurkingfridge79) * Under C++/Code Generation, change "Runtime Library" to "Multi-threaded Debug DLL" (for debug-mode apps) and "Multi-threaded DLL" (For release-mode apps). It is also recommended that you change your "Output Directory" (under General) and your "Working Directory" (under Debugging) to the ogre\Samples\Common\bin\(Debug|Release) directory. This will place the file in the same directory as the already-existing OGRE DLL and configuration files, which are required for any OGRE-based app to run. If you do not do this, you will need to copy a lot of the OGRE DLL and config files over to your output directory, as well as rework your config files and such to get it working properly. This is NOT recommended for your first shot at this. Once that's done, we can start to use OGRE. Create a file called main.cpp, and see ((Setting Up An Application - Shoggoth)). --- !!Code Blocks !!!GCC & ~np~Code::Blocks~/np~ __For Ogre 1.6.0 RC1__ the Code::Blocks workspace is not correctly configured. Download the Ogre source from SVN instead. See [http://www.ogre3d.org/phpBB2/viewtopic.php?t=44736|this thread] for additional information. __For Ogre 1.4__ follow this link ((Codeblocks and MinGW|#Building_Ogre_from_source|Code::Blocks + MinGW C++ Toolbox)). __For Ogre 1.2.2__ there is an alternative option of using ((CodeBlocks MingW STLPort|#Building_Ogre_from_source|Code::Blocks + MingW + STLPort)) __For Ogre 1.0.x with Code::Blocks 1.0RC2__ Here are the steps to build Ogre with mandrav's excellent [http://www.codeblocks.org|Code::Blocks IDE] under Windows. Performance Tip: It is suggested to disable Code::Blocks code completion plugin, before opening the Ogre workspace. This workspace contains ~40 projects which will be parsed. Since you 'll be building Ogre and not editing it, you won't be needing this parsing step. Installation steps: # [http://www.ogre3d.org/index.php?option=com_remository&Itemid=74|Download] the Ogre source distribution for Windows and unzip it. Everything will unpack in the ''ogre'' directory. # [http://sourceforge.net/project/showfiles.php?group_id=2997&package_id=149087|Download] ''codeblocks-dependencies-x.x.x.zip''. # Unzip ''codeblocks-dependencies-x.x.x.zip'' inside ''ogre'' (this creates the ''Dependencies'' directory) # Launch Code::Blocks and open ''ogre/Ogre.workspace'' (wait until all projects have loaded) # Hit "Build/Build Workspace" # Sit back for a few minutes (17mins on a Intel P4 3.0G) # Copy ''ogre/dependencies/bin/*.dll'' to ''ogre/samples/common/bin/release'' Before being able to run the provided samples, you should comment out (using a hash # in front of it) the line ''Plugin=RenderSystem_Direct3D7'' inside ''samples/common/bin/release/plugins.cfg''. You will need quake3 data files(.pk3 and .bsp) in order to run the BSP demo. If you have the files but got a ZipArchive::checkZzipError, just edit ''ogre\Samples\Common\bin\Release\quake3settings.cfg'' to point at your quake3 pak and bsp files. You might have a problem building ''PlatformManager_Win32'': The ''ogre/Ogre.workspace'' file has a 2 missing paths for the ''PlatformManager_Win32'' build. To fix it, do the following: # Right click on PlatformManager_Win32 in the workspace window on the left. # Select "Build Options" # Select the "Directories" tab and next the "Resource Compiler" tab. # Add the following 2 directores ''..\include'' and ''..\misc'', but clicking "Add" and the selecting those directories. # Everything should build correctly now. Enjoy! !!!MS Visual C++ Toolkit 2003 and ~np~Code::Blocks~/np~ Unfortunately the Visual C++ Toolkit does not come with necessary libraries for Multithreaded DLL compiling. This means you won't be able to compile Ogre with it, or at least not easily. The recommended solution for windows is to buy MSVC 7.1 or use [[#GCC & Code::Blocks|GCC]] with one of the IDEs available. ((User:Discipline|Discipline)) gave it a good shot at [http://www.ogre3d.org/phpBB2/viewtopic.php?t=11235&highlight=|this thread in the forums]. If you find a solution, please remove this and post it here. Also use the ((Codeblocks)) page for reference. Update: You can get the multi-threaded dll runtime libraries by following the instructions at: [http://manageddreams.com/osmpwiki/index.php?title=Notes_on_Microsoft_Visual_CPP_Toolkit_2003] --- !!Eclipse If you want to compile Ogre on Windows without cygwin, pkgconfig, autotools, bootstrap, configure, etc. and use only gcc, then take a look : ((Building Under Eclipse And GCC)) For question/suggestion use the forum thread : Eclipse + Gcc 3.4 (MinGW + Msys) + Ogre 1.0.3 ([http://www.ogre3d.org/phpBB2/viewtopic.php?p=90097)]. This is work in progress, feedback is appreciated. Help appreciated for a Linux + Mac version. [edit] (K)Ubuntu Linux Notes * Here ([http://inetserver.europe.homeip.net/~heiko/?p=102]) you can see what it takes to compile ogre on Ubuntu Linux. * If you run into linker problems with (K)Ubuntu and the aforementioned instructions, try issuing the command ''~np~export CC=g++~/np~'' before running ''~np~./configure~/np~'' Setting Up The Anjuta IDE You might want to use an IDE to make your development in Ogre a tad easier. To do so, follow the instructions in this Ogre Forum Thread ([http://www.ogre3d.org/phpBB2/viewtopic.php?t=5100]), but to paraphrase: * Make a new Generic / Terminal * After following the prompts, change your Project->Project Options Configuration tab and Libraries sub-tab and add: {CODE(wrap="1")}PKG_CHECK_MODULES(ogre, [OGRE >= 1.0.0]) AC_SUBST(ogre_CFLAGS) AC_SUBST(ogre_LIBS){CODE} * Then go into Settings -> Compiler and linker options and add ~np~${ogre_CFLAGS} to CFLAGS and ${ogre_LIBS}~/np~ in Linker Flags * Finally, go to Build->Autogenerate and it should update your make and config files automatically. Enjoy Ogre in Linux -- bana --- !!Cygwin Use the following if you don't want to have to setup Code::Blocks, but would like to have just a pure Cygwin/MinGW environment. Cygwin is used for it's building system and since it can nicely cross-compile for MinGW, you will have a build that doesn't depend on Cygwin anymore. Note: This information is ripped from this [http://www.ogre3d.org/phpBB2/viewtopic.php?t=6964|thread] in the the Ogre forums. # Fully install cygwin. You might need to add the correct path to ''/etc/profile''. # Get OGRE from CVS (there is a [http://www.ogre3d.org/index.php?option=com_content&task=blogcategory&id=74&Itemid=87|tutorial] on how to do it in the CVS Access section). I put this on ''/usr/dev/ogre''. This should also work with release version 1.0.0 or later - actually it worked with 1.0.0RC1 (I used the linux/OSX version. Didn't try the win32, but it must be not that different). # Get the MingW/Cygwin OGRE dependencies from the OGRE website. Either extract it to the root (thus creating ''/mingw'') or to another directory and create a symlink ''/mingw'' pointing to the correct location. If you want to build the OGRE dependencies yourself read ((Build OGRE dependencies using MSYS)). # Download and install libtool 1.5.12 (or newer). Version 1.5.10 (the one that came with cygwin) generates a few errors we want to avoid. ## Download the stable version from the [http://www.gnu.org/software/libtool/libtool.html|libtool website]. ## Configure and install it. ## Cygwin has a libtool wrapper that automatically selects 1.5.10 or 1.4.3 - we need to make it use our 1.5.12 (or newer) version instead. To do so, we first copy the libtool files from ''/usr/local/bin'' to ''/usr/autotool/1.5.x/bin'' (you'll have to create it), then edit ''/usr/bin/libtool'' to use that directory instead of the devel dir. It's just a quick, nasty hack - if someone knows of a better way to get the same result, please feel free to write your solution in right here. This shouldn't break anything though. ## (Optional): Go to a directory without configure.ac or configure.in files and do a 'libtool --version' to see if the first version number changed. If so, we can go to the next step. # Follow the instructions on the beginning of this post, which I modified slightly and reproduce here. This is to be done in the ogre directory: ## export PATH="$PATH:/mingw/bin" ## export ACLOCAL_FLAGS="-I /mingw/share/aclocal" ## export PKG_CONFIG_PATH=/mingw/lib/pkgconfig ## ./bootstrap ## ~np~CC="gcc -mno-cygwin" CXX="g++ -mno-cygwin" CXXFLAGS="-O2 -I/mingw/include" LDFLAGS="-L/mingw/lib -L/lib/w32api" ./configure --with-ft-prefix=/mingw --with-platform=Win32 --with-gl-support=Win32 --disable-static --build="i686-pc-mingw32" --enable-direct3d~/np~ ## make ## make install # Set up your development tools. ## Passing the arguments "~np~-lOgreMain -Wl,--enable-runtime-pseudo-reloc~/np~" to the linker will work. ## As far as library directories go, you can link to ''cygwin/usr/local/lib'' and be happy about it. ## Include directories: ''cygwin/usr/local/include'', ''cygwin/usr/local/include/OGRE'' and ''ogre/Samples/Common/include'' (if you are using the ExampleApplication class). Where I say ''cygwin/'', I actually mean the cygwin path (such as ''c:/cygwin'') and the same goes for ''ogre/'' (''c:/cygwin/usr/local/ogre/ogre'', for example). ## This is not required, but I tend to copy all required DLLs to my build directory (the one where MingW puts my compiled binary in). By this, I keep my environment clean and you can just copy that directory to another computer and run it with its own dlls. This avoids mess. There you go. You should be able to safely build any post-1.0.0 with this, unless there are some big changes that break the process. __Additional Notes :__ # With the last releases of Cygwin, you don't have to compile a new libtool anymore. # I had to tune the makefiles of several Plugins in order to compile: the ld option "-Wl,-z,defs" was refused. I replaced it with its other syntax "-Wl,--no-undefined" everytime I found it and it worked well. --- !!GCC & Dev C++ {DIV(class="achtung")}__Note: This is deprecated, and generally not recommended.__ DevCPP is old, the Ogre devpak is old, and you will have a much better time using Code::Blocks with MingW.{DIV} If you really, really want to do this, keep in mind that you are on your very own here. You are not likely to get any support on the OGRE Forum, other than people telling you to try other options. You have been warned: ((DevCPP building|Building From Source using DevCPP))
Search by Tags
Search Wiki by Freetags
Latest Changes
Projects using OGRE
Building Your Projects With CMake
Compiled API Reference
Overlay Editor
Introduction - JaJDoo Shader Guide - Basics
RT Shader System
RapidXML Dotscene Loader
One Function Ogre
One Function Ogre
...more
Search
Find
Online Users
198 online users
OGRE Wiki
Support and community documentation for Ogre3D
Ogre Forums
ogre3d.org
Log in
Username
Password
CapsLock is on.
Remember me (for 1 year)
Log in