Create a new Cocos2d-x V3.10 project under Windows (cocos2d-x lua)

cocos2d-lua V3.10. There are still some problems in the new construction. After several days of research, it was finally realized.

Step 1: First create a new project with V3.10 software, as shown in the figure:



Step 2: Compile the newly created project with VS:



Step 3: Add the Win32 control output console, otherwise you will not see the Log information

1) Add the following code to main.cpp in the project:


Code:

[cpp]  view plain copy  
  1. #ifdef USE_WIN32_CONSOLE  
  2.     AllocConsole ();  
  3.     freopen("CONIN$""r", stdin);  
  4.     freopen("CONOUT$""w", stdout);  
  5.     freopen("CONOUT$""w", stderr);  
  6. #endif  


2) Add the following code in the properties of the project - "C/C++-"Pre-editing -":



Code:

[html]  view plain copy  
  1. USE_WIN32_CONSOLE  


Step 4: Copy the files under the compiled directory D:\simulator\win32 to the main project directory.


Step 5: Open the MainScene.lua file in the Sublime editor, write a print() output log, and then click the exe in the main directory to run the program. The project can be opened.



Finally, basically a new project is established, I hope it can help newbies~

Reprint https://blog.csdn.net/sung26/article/details/51829027

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325603509&siteId=291194637