Problems deploying to windows

Hi, I’m using cocos2dx v 3.16 with Visual Studio 2017. I am having trouble deploying my application with the deploy command. Whenever the application starts building it says return error code 1 claiming that it didn’t find any localized resources, as well as linking me to an error file.


I don’t know what I need to do to fix this issue, any help would be greatly appreciated.

It looks like you upgraded your solution file from a previous version of Visual Studio, so all those errors that it showed you need to be fixed before you can build your project.

So how do i upgrade all the projects so that they use the same version?

First thing you need to do is figure out what those errors mean, then work out what you need to do to fix them. I’m sure an internet search engine can help with that. If I were to guess, it may just be missing entries in the configuration section of the vcxproj file for each of those projects. See if the configuration sections look something like this, and if not, then you’ll need to update them:

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
    <PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
    <PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
    <PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v140_xp</PlatformToolset>
    <PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
    <PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v141_xp</PlatformToolset>
  </PropertyGroup>

Note that this is just one example for a release configuration, so you need to update any configurations you have with the relevant lines for VS2017, which are these:

<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0'">v141</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '15.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v141_xp</PlatformToolset>

I checked all the projects and all of them have the same configuration as the one above. I also tried making a new project and deploy the basic cocos2dx example, but it still showed the same problems. The errors link me here: https://docs.microsoft.com/en-us/visualstudio/porting/port-migrate-and-upgrade-visual-studio-projects?projecttype=8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942&view=vs-2017, but I still don’t understand how to fix this issue.

Try to make a project using Cocos2d-x 3.17, and the results from that will help you narrow the problem down.

If a new project from Cocos2d-x 3.17 works fine in VS2017, then the problem is with the project files from v3.16.

If v3.17 projects still give you errors, then the problem has something to do with your development environment, and not Cocos2d-x.

Yeah I did that yesterday too, I went from cocos2dx v3.16 to v3.17 and still got the same errors.

Well, at least now you know that it is most likely an issue with your development environment, or something that you’re doing incorrectly, that is causing the problem. What steps did you follow to create a new project and compile it? Take screenshots of each step as you do it, including a screenshot of Visual Studio (with the project tree visible) after you try to compile it, and post them here. Otherwise, type out the exact steps, and don’t miss anything, otherwise this will just be a lot of guesswork and time wastage.

I basically follow all the steps in this video:

  • Installing python2.7

  • Setting up the ant, ndk, and jdk root

  • calling python.setup to setup cocos2dx

  • Creating a new cocos2dx project with c++ as its language

  • Building all the solution, and make sure it works in debug and release

  • Deploy it with the deploy command and win32 as its platform

  • Get the error code that’s shown in the first post.

Here is a picture of the project tree:
Screenshot%20(43)

Properties:

Ignore that video you linked for now, and do this

If you don’t have CMake installed, then install it by going to cmake.org, and download the relevant cmake-3.12.4 for your operating system (most likely for you it would be cmake-3.12.4-win64-x64.msi. After it is installed, open a console window and run the command “cmake --version” to make sure that it’s working.

Create a new Cocos2d-x 3.17 project with this command:

cocos new Apophis -p com.example.apophis -l cpp -d .

Now, in a console window, go into the Apophis directory that has been created.

Type this in:

mkdir win32-build && cd win32-build
cmake .. -G"Visual Studio 15 2017" -Tv141

In Visual Studio, open the solution that located in the Apophis/win32-build/ folder. It may be called TemplateCpp.sln because of a bug inCocos2d-x 3.17. You can rename it later (from inside Visual Studio), but for now do not change the name of that file.

Compile and run it. It should work, and if it doesn’t, be very specific as to what errors you get, otherwise there’s little else I can help you with.

Hi R101, thanks for your help. I created a test project with cocos new command and then went into the directory and did the cmake command that you asked me to do, then I compiled and run it- which worked perfectly. But I tried using the deploy command to turn the application into a single executable but it showed me the same errors after calling -deploy. Here are some pictures:

To summarize:
cocos new Test -p com.InversePalindrome.Test -l cpp -d C:\Users\Bryan\Desktop
cd C:\Users\Bryan>cd C:\Users\Bryan\Desktop\Test
mkdir win32-build && cd win32-build
cmake … -G"Visual Studio 15 2017" -Tv141
compile and make sure it runs(which it did)
cocos deploy -p win32 → get return error return 1 which sends me to a log file that has the same errors as in the first picture of the thread. I basically want to deploy the application into a single executable as seen on this video

I have never used the deploy command, so I really don’t have any info that would help sort out your issue. Perhaps someone else here can jump in and help with that.

If the purpose is to create an executable that bundles everything into an installation file, then have you considered using something like InnoSetup (http://www.jrsoftware.org/isinfo.php)? It’s great, and it’s free.

1 Like