wsjcpp/wsjcpp-yaml

does this support windows? got some errors and the compilation failed

xkungfu opened this issue · 5 comments

wsjcpp_core.cpp:21:10: error: 'arpa/inet.h' file not found

\src.wsjcpp\wsjcpp_core\wsjcpp_core.cpp:511: error: no member named 'd_type' in 'dirent'
src.wsjcpp\wsjcpp_core\wsjcpp_core.cpp:511: error: use of undeclared identifier 'DT_DIR'
\src.wsjcpp\wsjcpp_core\wsjcpp_core.cpp:560: error: no matching function for call to 'mkdir'
\unit-tests.wsjcpp\src\process_mem_usage.h:51: error: '_SC_PAGE_SIZE' was not declared in this scope

change #include <arpa/inet.h> to #include <Winsock2.h> solved this problem.

and commented all functions about read write file. maybe need to modify some of them later.

at last, please give a new version readme. I modified the example to below, and works.


    std::string sTestYaml =
                "# yaml content\n"
                "yaml1: nice format\n"
                "some-map: value1\n"
                "some-map2: value2\n"
                "some-array:\n"
                "  - test1 \n"
                "  - test2 \n"
                "some-am: # array + map element \n"
                "  - p1: v1 \n"
                "    p2: v2 \n"
                "  - p1: v3 \n"
                "    p2: v4 \n"
                "param2: 111\n";

    WsjcppYaml yaml;
    std::string sError;
    yaml.loadFromString("parse_all", sTestYaml, sError);

    if (sError.compare("Error parsing") == 0) {
        WsjcppLog::throw_err(TAG, "[test.cpp>>test] Error parsing");
        return -1;
    }

this is very good library, thanks for the nice work!

yep... not yet support windows :(
I can try fix it.

Can you please check this (unit-tests will be not work on windows yet, but basic classes will):

And you can use like:

if (!yaml.loadFromString("parse_all", sTestYaml, sError)) {
    std::cerr << "[test.cpp>>test] Error parsing" << std::endl;
    return -1;
}

Please look in this branch (README updated and no need more include wsjcpp_core.*):

https://github.com/wsjcpp/wsjcpp-yaml/tree/version-0.1.7

thank you for reply so quick.

one problem and one suggestion:

1 loadFromString need 3 arguments, in readme example lost two arguments.

2 I think wsjcpp_core is very useful. in most case, functions in it works well. I commented some functions because the ifstream can't read file that there is UTF8 code in the path. but finally I resolved it, just need to convert UTF8 to ANSI.

maybe you can preserve wsjcpp_core as an optional module and default to be commented.

  1. Yep Thanks. Fixed it in a branch!
  2. Maybe later I try porting source library https://github.com/wsjcpp/wsjcpp-core to windows too, just have not enough time. But I wanna do this.