Eclipse + CDT + mingw development DirectX Program

Source: Internet
Author: User
To transfer to the GCC/g ++ platform for development, I tried eclipse + CDT + mingw for development. After a long test, I finally compiled it successfully. The process is roughly as follows:

1. First of all, download eclipse + CDT. Now CDT has reached 5.0, and C ++ has rich reconstruction functions.

2.
It is impossible to have CDT without a compiler. Download mingw + msys. Pay attention to setting system environment variables after installation. You can write a simple C ++ hello
During the worldtest, when compiling, you can find the cc1plus.exe prompt. You only need to search the mingw directory to find its location (for example, mingw/libexec
/GCC/mingw32/3.4.5), then set the environment variable in the system settings of the control panel, and add this directory to the PATH variable. Usually, eclipse automatically sets
Set the call command of the compiler to GCC/g ++, so no additional settings are required.

3. Create a new C ++ project and compile the Windows + DirectX program,
You need to set up the project. If you have done DirectX development in VC/Vs, it should be no stranger. Enter the project setting box and enter C ++
Build-> Settings. We can see that there are many settings on the right side, which are listed one by one.

4. gcc C ++ Compiler
(1) Preprocessor: add three items for defined symbols: Win32 _ WINDOWS _ debug
(2) directories: add the DirectX SDK include folder directory, for example, "E:/Microsoft DirectX SDK/include"
(3) Miscellaneous, set flag:-C-fmessage-length = 0-mthreads-fexceptions-fident-mwindows

5. minggw C ++ linker
(1) libraries,
Add the required Lib, DLL, and a files to libraries. Note that no suffix is required. For example, AAA. Lib only requires AAA. For example: mingw32
D3dx9d winmm d3d9; Add the DirectX SDK lib directory in libraries, for example, "E:/Microsoft
DirectX SDK/lib/x86"
(2) Miscellaneous: Set linker flags:-mwindows; Set otheroptions:
-- Enable-auto-image-base -- add-stdcall-alias

6. Then write the code. Pay attention to DirectX.
All Unicode-related content in the SDK routine should be removed. For example, l "XX" should be changed to "XX", lpwstr should be changed to lpstr, and wwinmain should be changed to winmain.
Currently, how to correctly compile Unicode is not found (# Link error occurs after define Unicode ).

7. Compilation and debugging are the final part. You don't need to talk about this ~

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.