線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:2168
推到 Plurk!
推到 Facebook!

[轉貼]Compiling the DirectX 8 SDK Samples with BCB

 
axsoft
版主


發表:681
回覆:1056
積分:969
註冊:2002-03-13

發送簡訊給我
#1 引用回覆 回覆 發表時間:2002-06-18 21:56:27 IP:163.31.xxx.xxx 未訂閱
文章來源:http://www.geocities.com/foetsch/bcbfaq/bcbdx8.htm    Compiling the DirectX 8 SDK Samples with C++Builder This article is a work in progress!    Abstract This article is meant as an add-on to the article "Using DirectX with C++Builder" [6], which is also available on this site. This article deals specifically with the DirectX 8 SDK. I'm currently in the process of writing this article, so new information will be added. In the meantime, this article--along with the other article mentioned before--should answer many of the questions that are frequently asked about DirectX 8 and C++Builder in the Borland newsgroups [1].    Introduction Many Borland users are confused by the fact that the new DirectX 8 SDK does not ship with Borland-compatible link libraries. I haven't had much time to play around with the DirectX 8 SDK. However, I have succeeded in compiling some of the Direct3D samples with C++Builder--and it took me only a few minutes.    Converting the Visual C++ Projects to C++Builder Projects What I like about the DirectX 8 SDK is that it comes with Visual C++ workspace (.dsw) files that make it easy to create C++Builder projects for the samples. C++Builder 5 (I don't know about earlier versions) comes with a utility that converts .dsw and .dsp files to C++Builder project files. This utility is available from the Tools menu in the C++Builder IDE. You can also start it by double-clicking on the file vctobpru.exe in the \CBuilder\bin folder. To create a C++Builder project group for all Direct3D samples, for example, you would convert the file \samples\multimedia\direct3d\d3d.dsw. See Figure 1 below: (Thanks to Matt Crawford for providing the screenshots from the English version of C Builder!) Next, you choose one of the individual projects that you wish to convert. Unfortunately, there is no way to select multiple projects at a time. See Figure 2: Each of the Visual C projects stores two configurations: Debug and Retail. Usually, I choose the Debug configuration when converting Visual C projects. However, you can go from Debug to Retail at a later time by setting the project options from the C Builder IDE. See Figure 3: After you press the "Convert" button, the project is converted. You'll receive a few warnings about Visual C project options that can't be converted. You can ignore these warnings. See Figure 4: When you convert a .dsw file that contains more than one project (like d3d.dsw), make sure to convert all of the projects before opening the .bpg file that is created. Otherwise, C Builder will complain about missing project files and remove the other projects from the project group. After you've used the conversion utility, you will find the file d3d.bpg in the \samples\multimedia\direct3d folder. Open this file Creating Borland-compatible Import Libraries In this section, I will explain how to use the Coff2Omf utility to create Borland-compatible import libraries (.lib files) from the libraries that ship with the DirectX 8 SDK. To make working with the Coff2Omf utility (and all other command-line utilities that come with C Builder) easier, you should first build the WinTools example, which can be found in the \CBuilder\Examples folder. Next, fire up the utility and go to the "Coff2omf" tab. Click the "Browse" button and select the file \lib\d3d8.lib (or whatever library you need). Click the "Run" button as shown in Figure 5: Coff2Omf creates the file d3d8OMF.lib. Using Windows Explorer, go to the \lib folder and create the sub-folder "borland". Copy the newly created .lib file to that folder and remove the "OMF" from its file name. Now, the path to the Borland-compatible d3d8.lib should be \lib\borland\d3d8.lib. I'm quite sure that there are some files that can't be converted using Coff2Omf.exe. For these files, generate an import library from the DLL by using the ImpLib utility. The ImpLib utility can also be accessed through the WinTools program. If the .lib file in question is a static library, you can't create a Borland-compatible .lib file. That's the sad truth... For more information about the ImpLib utility, see also the article "Using DirectX with C Builder" [6]. Updating the C Builder Include Path You should update the include path and the library path of the C Builder project so that the compiler finds all .h files (and uses the correct versions) and the linker finds all .lib files (and uses the correct versions). To do this, open the Project Options dialog by choosing "Project | Options" from the menu. Go to the "Directories/Conditionals" tab as shown in Figure 6: Add \include to the include path and \lib\borland to the library path. Make sure that these two paths are the first paths in their respective edit box. If you clicked the ellipses ("...") button to open the Folders dailog, use the Up button as shown in Figure 7 so that the paths appear at the top of the list: Now you should be able to compile the project. I only tested with a few of the Direct3D samples. I'm sure that there are some projects that won't compile that smoothly. However, I'll reserve that for the next update of this article. What else? I hope this article was of help. The article will be updated as soon as I have some time to add new material. If you have any questions, answers, or comments, feel free to e-mail me! See also "Using DirectX with C Builder" [6], which answers many general questions about using Visual C code with C Builder.
系統時間:2024-12-04 1:24:16
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!