How to use DirectX in BCB

Source: Internet
Author: User
Tags win32

This is a brief guide to how you can use the DirectX SDK in BCB.

I'm here to assume that your BCB installation path is: C:\borland\cbuilder\,directx SDK in C:\dx5sdk\

Set up Borland C + + Builder

#include

This is a problem for many people, Borland BCB's \include path provides the header file for DirectX, and if you just add c:\dx5sdk\sdk\inc\ to BCB's include path, it does the following:

Find C:\Borland\Cbuilder\Include\ Path

Find Ddraw.h header file, use it;

Besides what he found was DirectX3 's head, there was no harm, but it was not a good thing.

To avoid BCB, I recommend that you simply copy the files under the \inc path of the DirectX SDK to the BCB \include path and overwrite the original DirectX header file, and believe me, this is the best of all solutions.

Library files

There may be something wrong with the library files that are being used by the Borland compiler that is released with DirectX, I suggest you download this file here, unzip it under the BCB \lib path, and all ok!

About Engineering

Do not use the wrong template to create a project, to create a program, you may soon understand what is called the "miserable World", the sensible solution is to do the following four simple steps:

Create a console program (console application);

to the Options | The Project menu selects the linker page and then sets the console to the Win32 GUI,

Write WinMain () functions and WinProc () functions:

Write the other parts.

Here's an example.

Is it over?

Unfortunately, no! BCB uses an old way to handle "define", so add the following code to the define part of each DIRCETX application:

#if defined (__borlandc__) && defined (__win32__)

#define _win32

#endif

It's about the same now.

Other issues

If there is a problem at compile time, try adding the following code:

#define WIN32

#define WIN95

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.