golang+sdl2.0 Environment Construction under win8.1

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.
    • sdl2.0 Golang Binding I am using this, but it's official introduction only Linux and OSX system instructions, no windows, in my MBP after the set up to consider in win also set up a development environment, so it can be more convenient cross-platform.
    • The steps are as follows:
    1. To configure the go environment, you can refer to the official documentation or here.
    2. Go get the above mentioned library, but repeatedly prompt the following error:

      Cc1.exe:sorry, Unimplemented:64-bit mode not compiled in

      Later found that as long as the use of CGO will be reported this error, because I downloaded the Go 1.3.2 64-bit version, but the local GCC is 32-bit. Toss for a long time did not solve, has not been able to download to 64-bit MinGW, the official download is half of the time to download the error, even if the agent is hung on the sf.net, later found a good-hearted person to do the offline download package, and then add GCC to the PATH environment variable , I can only use the CGO.
    3. To this again build go-sdl words, will be prompted to find sdl2/sdl.h file, this problem is more toss,
      Google for a long time no one to give a concrete solution, did not mention CGO compile, the corresponding C file needs to be placed under what directory. Perhaps too simple to mention it, but for the novice is a more troublesome thing. Some people say that they can solve the source code, it is true, but please clarify the primary purpose: To learn to use Golang to develop the SDL program.
    4. At first I was trying to put SDL's header file into the GITHUB.COM/VEANDCO/GO-SDL2/SDL directory,
      Because there are already some C files in the directory, so consider CGO will search the current directory, the result has failed, it can only search the current directory, once placed in a subdirectory is not. Next try to use absolute path, still fail, not clear for. Then came to think that CGO was compiled C code through GCC, so the official SDL download binary package (MinGW version) extracted into the GCC directory (SDL official MinGW package should contain bin,include,lib,share these directories, Simply place them in the GCC root directory and overwrite them with the same name directory)
      Then go build, everything OK

At this point, the whole environment should be done, let ' go

Related Article

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.