HttpClient development environment settings under Visual Studio in Cocos Development

Source: Internet
Author: User

? Cocos2d-x 3.x integrates network communication-related classes into the Libnetwork Class Library project, which includes the HttpClient class. We need to add the Libnetwork Class Library project to the Visual Studio solution.
In order to be able to develop httpclient under visual Studio 2012, we need to set the content as follows:
Add the Libnetwork Library project to the solution.
Add a libnetwork library reference.
Configure the header file search path.
Configure the Libcurl library.


1, add Libnetwork Library project in the solution
First, open the solution, right-click on the solution Hellocpp, select "Add" → "existing project" in the context menu, then select the Libnetwork.vcxproj project file in the popup dialog, the specific project path is "< Project catalog >\ Cocos2d\cocos\network\proj.win32 ". Once added, we'll see that the Libnetwork project has been added to the solution.

add Libnetwork project

2, add libnetwork Library Reference
and then, We right-click on the game project in the solution, select "Properties" in the right-click menu, Pop-up the Project Properties dialog box, select "Common Properties" → "frame and reference" in the Properties dialog, then click the "Add New Reference" button to the right, select "Libnetwork" in the pop-up dialog, and then click "OK" Button.

Add libnetwork Library Reference

3, configure header File search path
Configure header file search path, select Game project, open menu" project " → Properties pop-up Project Properties dialog box, select "Configuration Properties" → "C + +" → "general", add $ (engineroot) Cocos to "additional included directories" to the right, and note that the configuration should be separated by semicolons.


Configure header File Search path


After you add the search path, you can add the following code to the program to introduce the header file.

#include "Network/httpclient.h"
The project is then compiled and the configuration succeeds if there is no compilation error.


4. Configure Libcurl Library

Since HttpClient relies on the Libcurl library, you need to configure the Libcurl library in the solution, refer to the previous blog: Cocos Development under Visual Studio Libcurl Library development environment settings.


For more information, please pay attention to the first Cocos2d-x 3.2 Edition book "Cocos2d-x: C + + volume" book Exchange Discussion website: http://www.cocoagame.net
For more exciting video courses, please follow Cocos class: Http://v.51work6.com
Welcome to join Cocos2d-x Technical Discussion group: 257760386 Welcome to Luxgen iOS Classroom public platform


HttpClient development environment settings under Visual Studio in Cocos Development

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.