V3.17 + Visual Studio - What creates the .vcxproj files

Hi,
I’m still trying to understand the architecture of cocos2d-x

Looking at other peoples example projects, the cocos2d/external libraries they use have .vcxproj files
These do not exist in the cocos2d-x distribution or a new project created from it.

What creates them or how are they created?

You cannot add the library as a subproject in visual studio without that file…

If I copy an example project to a newly created project, replacing everything except the cocos2d directory (so all project-specific source, headers, resources etc. are in place) and try to open and build that, any libs in cocos2d/externals are missing (yellow triangle “!”) in visual studio & it gives linker errors as the sub-projects are not built.

The header file references for the externals are obviously still in the source files, but seem to have no effect.

I have searched a lot for possible solutions but the only references I can find to similar questions seem either unanswered or the answers refer to pages that no longer exist.

RJ.

Asuming you talk about VC and win32 or Win64:
Most libraries in cocos2d-x 3.17 are replaced by prebuilds.
So you do not need the .vcxproj files any more.
Previous to 3.16 many libraries where shipped with sources - to compile it, there was a need of the .vcxproj-files.
Create an empty project with V. 3.17 and discover the link options in VC (display command line):
i. e. ... /DYNAMICBASE "libcurl.lib" "opengl32.lib" "glew32.lib" "libzlib.lib" "libwebp.lib" "libiconv.lib" "freetype.lib" "winmm.lib" "ws2_32.lib" "libSpine.lib" "libbox2d.lib" "libpng.lib" "libjpeg.lib" "libtiff.lib" "libchipmunk.lib" "glfw3.lib" "libbullet.lib" ...

This is the new magic…

For updating your project and to use the external libraries as prebuild, link them manually or use linker-options|additional dependencies:
libcurl.lib;%(AdditionalDependencies);$(_COCOS_LIB_WIN32_BEGIN);$(_COCOS_LIB_WIN32_END)

This explains also why the header files are still there…

Please help how to add prebuild libbox2d in project.
I tried to add libbox2d.lib in Project Properties -> Linker -> Input -> Additional Dependencies like this

libbox2d.lib;libcurl.lib;%(AdditionalDependencies);$(_COCOS_LIB_WIN32_BEGIN);$(_COCOS_LIB_WIN32_END)

And i have also added the library folder path in Linker -> General -> Additional Lilbrary Directories
This is the path.

E:\Cocos2dx317\external\Box2D\prebuilt\win32\release;$(OutDir);%(AdditionalLibraryDirectories);$(_COCOS_LIB_PATH_WIN32_BEGIN);$(_COCOS_LIB_PATH_WIN32_END)

But not worked for me.
What i am doing wrong?

You have to decide to use either chipmunk or libbox2d: you can not enable both

You have to edit project properties for libcocos2d and your project:
c/c++/prepocessor: change CC_ENABLE_CHIPMUNK_INTEGRATION=1 to CC_ENABLE_BOX2D_INTEGRATION=1

That should do it - it worked for me on cpp-tests with v3.17!

1 Like

Thanks it worked, but we need to add this line too

$(EngineRoot)external\Box2D\include;

in ProjectProperties -> C/C++ -> General -> Additional Include Directories

2 Likes