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
Then we right-click on the game project in the solution, select "Properties" in the right-click menu, pop Up the project Properties dialog, select "Common Properties" → "frames and references" in the properties dialog, then click on the right "Add New Reference" button, select "Libnetwork" in the pop-up dialog, then click " OK button.

Add Libnetwork Library Reference

3. Configure header File Search path
Configure the header file search path, select the game Project, open the menu "project" → "properties" pop-up project Properties dialog box, select "Configuration Properties" → "C + +" → "general", add $ (engineroot) Cocos to the right of "additional included directories"; Note that the configuration items need to 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 discussionwebsite: http://www.c ocoagame.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.