Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MSVC] Libfacedetection build failed due to error C2039: 'to_string': is not a member of 'std' #348

Open
Zhaojun-Liu opened this issue Dec 6, 2022 · 2 comments · May be fixed by #349
Open

Comments

@Zhaojun-Liu
Copy link

Zhaojun-Liu commented Dec 6, 2022

Description:
Recently, we updated the commit of bitcoin for MSVC RWC testing, it failed to build due to the error C2039 and error C3861 like below, could you please help take a look? Thanks.

F:\gitP\ShiqiYu\libfacedetection\src\facedetectcnn.cpp(638,17): error C2039: 'to_string': is not a member of 'std' [F:\gitP\ShiqiYu\libfacedetection\build_amd64\facedetection.vcxproj]
         F:\gitP\ShiqiYu\libfacedetection\src\facedetectcnn.cpp(638,26): error C3861: 'to_string': identifier not found [F:\gitP\ShiqiYu\libfacedetection\build_amd64\facedetection.vcxproj]

Expected behavior:
Build successfully.

Actual behavior:
Build failed with error C2039 and error C3861

To reprodece:

  1. open VS2019 x64 Native Tools command.
  2. git clone https://github.com/ShiqiYu/libfacedetection F:\gitP\ShiqiYu\libfacedetection
  3. mkdir F:\gitP\ShiqiYu\libfacedetection\build_amd64 and cd F:\gitP\ShiqiYu\libfacedetection\build_amd64
  4. cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_SYSTEM_VERSION=10.0.18362.0 -DCMAKE_INSTALL_PREFIX=install -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DDEMO=OFF ..
  5. msbuild /m /p:Platform=x64 /p:Configuration=Release libfacedetection.sln /t:Rebuild

More info:
The commit of Libfacedetection we use: 4092665
VS version: VS2019 (v16.11.20)

Detailed log:
build.log

@fengyuentau
Copy link
Collaborator

Looks like the string header is missing. Have a try with including it in the beginning of facedetectcnn.cpp:

#include "facedetectcnn.h"
#include <cmath>
#include <float.h> //for FLT_EPSION
#include <algorithm>//for stable_sort, sort

+ #include <string>

typedef struct NormalizedBBox_
{
    float xmin;
    float ymin;
    float xmax;
    float ymax;
    float lm[10];
} NormalizedBBox;

@Zhaojun-Liu
Copy link
Author

Looks like the string header is missing. Have a try with including it in the beginning of facedetectcnn.cpp:

#include "facedetectcnn.h"
#include <cmath>
#include <float.h> //for FLT_EPSION
#include <algorithm>//for stable_sort, sort

+ #include <string>

typedef struct NormalizedBBox_
{
    float xmin;
    float ymin;
    float xmax;
    float ymax;
    float lm[10];
} NormalizedBBox;

I have tried to include the string header in the facedetectcnn.cpp or facedetectcnn.h, both are worked 😃

@fengyuentau fengyuentau linked a pull request Dec 8, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants