Question about working with Visual Studio

Question about working with Visual Studio

Hi to all,
I’m new to cocos2d-x. I worked with Objective-c version years ago and publish a few games.
Decided to learn C++ and cocos2d-x but I’m having problems adapting with Visual Studio and I have question for experienced users(if this post is not appropriate, admins may delete it).

The problem I’m having is:
I can’t see the folder “Classes” in Visual Studio and If want to create a new class/files they end up in the {Project}\proj.win32 folder. I realized that “Solution explorer” is some kind of database and not a file system tree and I can create files in the windows explorer and drag them there(from {Project}\Classes) but it just not feels right. I’m new to VS and trying to find a solution for a few days now.

My question is, what is your typical workflow with VS for creating classes and structuring the code?

Thank you.

Hi. you can create your class in classes folder then add this class as an existing file to VS project. If your project built in VS then there is nothing wrong about your approach.

Are you using the CMakeLists.txt to define your source file list? If you do, then use CMake to generate the VS solution and project files, you will see Classes in the Visual Studio solution explorer.

That will not solve the issue of creating a class and it ending up in the wrong folder, which I know is frustrating. You can get around it by right clicking the solution, click Add, New Item, then selecting the header, and set the path to where you want it to be saved, and then do the same again for the cpp file.

Alternative solutions here (including prefixing the class name with a relative path): new class creation

This specific issue is on the TODO list for the Microsoft devs, somewhere in the backlog, and one day they’ll get around to fixing it.

There is an alternative solution. If you’re willing to invest in ReSharper C++, it will fix this issue for you, along with making your development experience so much better. You can right click on a folder, click “Add->New Item from template”, and like magic, it appears in the correct folder.

Thank you for your reply. Yes, you are right, I can do that. But I was asking myself if this is the workflow everyone is using.

Coming from Android Studio and X-Code feels a bit strange to create files with explorer/finder and then drag them to the studio. That’s why I decided to ask more experienced users here on the forum what is their workflow.


i open the classes structure in file explorer, when i want to make a new header and cpp I:

  1. copy and paste a header and cpp within the file explorer

  2. rename it

  3. drag it into the VS “src”

  4. add the code i need to it.

can you elaborate?