We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
hi,I encountered a problem when introducing libucl through cmake this is build error make -j [ 50%] Building CXX object CMakeFiles/libucl_demo.dir/example_libucl.cc.o /home/maomao/git/database/LinTSDB/Test/libucl/example_libucl.cc: In function ‘int main(int, char**)’: /home/maomao/git/database/LinTSDB/Test/libucl/example_libucl.cc:7:2: error: ‘ucl_parser_t’ was not declared in this scope ucl_parser_t parser = ucl_parser_new(0); ^~~~~~~~~~~~ /home/maomao/git/database/LinTSDB/Test/libucl/example_libucl.cc:7:2: note: suggested alternative: ‘ucl_parser’ ucl_parser_t parser = ucl_parser_new(0); ^~~~~~~~~~~~ ucl_parser /home/maomao/git/database/LinTSDB/Test/libucl/example_libucl.cc:7:16: error: ‘parser’ was not declared in this scope ucl_parser_t parser = ucl_parser_new(0); ^~~~~~ /home/maomao/git/database/LinTSDB/Test/libucl/example_libucl.cc:7:16: note: suggested alternative: ‘strsep’ ucl_parser_t parser = ucl_parser_new(0); ^~~~~~ strsep /home/maomao/git/database/LinTSDB/Test/libucl/example_libucl.cc:18:22: error: invalid conversion from ‘const ucl_object_t’ {aka ‘const ucl_object_s’} to ‘ucl_object_t’ {aka ‘ucl_object_s’} [-fpermissive] ucl_object_unref(obj); ^~~ In file included from /home/maomao/git/database/LinTSDB/Test/libucl/example_libucl.cc:3: /usr/local/include/ucl.h:767:49: note: initializing argument 1 of ‘void ucl_object_unref(ucl_object_t*)’ UCL_EXTERN void ucl_object_unref (ucl_object_t *obj); ~~~~~~~~~~~~~~^~~ make[2]: *** [CMakeFiles/libucl_demo.dir/build.make:82:CMakeFiles/libucl_demo.dir/example_libucl.cc.o] 错误 1 make[1]: *** [CMakeFiles/Makefile2:95:CMakeFiles/libucl_demo.dir/all] 错误 2 make: *** [Makefile:103:all] 错误 2
this is my cmake file ` cmake_minimum_required(VERSION 3.10...3.21) project(libucl_demo CXX) set(CMAKE_CXX_STANDARD 11)
set(SOURCE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/example_libucl.cc) set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) find_package(ucl REQUIRED) include_directories(${LIBUCL_INCLUDE_DIRS})
add_executable(${PROJECT_NAME} ${SOURCE_FILE})
target_link_libraries(${PROJECT_NAME} ucl::ucl)
`
this is my example file ` #include #include #include <ucl.h>
int main(int argc, char **argv) { ucl_parser_t *parser = ucl_parser_new(0); ucl_parser_add_file(parser, "config.conf"); const ucl_object_t *obj = ucl_parser_get_object(parser); ucl_parser_free(parser); const ucl_object_t *value = ucl_object_lookup_path(obj, "section.key"); if (value != NULL) { const char *str_value = ucl_object_tostring(value); printf("config value: %s\n", str_value); } ucl_object_unref(obj); return 0; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
hi,I encountered a problem when introducing libucl through cmake
this is build error
make -j
[ 50%] Building CXX object CMakeFiles/libucl_demo.dir/example_libucl.cc.o
/home/maomao/git/database/LinTSDB/Test/libucl/example_libucl.cc: In function ‘int main(int, char**)’:
/home/maomao/git/database/LinTSDB/Test/libucl/example_libucl.cc:7:2: error: ‘ucl_parser_t’ was not declared in this scope
ucl_parser_t parser = ucl_parser_new(0);
^~~~~~~~~~~~
/home/maomao/git/database/LinTSDB/Test/libucl/example_libucl.cc:7:2: note: suggested alternative: ‘ucl_parser’
ucl_parser_t parser = ucl_parser_new(0);
^~~~~~~~~~~~
ucl_parser
/home/maomao/git/database/LinTSDB/Test/libucl/example_libucl.cc:7:16: error: ‘parser’ was not declared in this scope
ucl_parser_t parser = ucl_parser_new(0);
^~~~~~
/home/maomao/git/database/LinTSDB/Test/libucl/example_libucl.cc:7:16: note: suggested alternative: ‘strsep’
ucl_parser_t parser = ucl_parser_new(0);
^~~~~~
strsep
/home/maomao/git/database/LinTSDB/Test/libucl/example_libucl.cc:18:22: error: invalid conversion from ‘const ucl_object_t’ {aka ‘const ucl_object_s’} to ‘ucl_object_t’ {aka ‘ucl_object_s’} [-fpermissive]
ucl_object_unref(obj);
^~~
In file included from /home/maomao/git/database/LinTSDB/Test/libucl/example_libucl.cc:3:
/usr/local/include/ucl.h:767:49: note: initializing argument 1 of ‘void ucl_object_unref(ucl_object_t*)’
UCL_EXTERN void ucl_object_unref (ucl_object_t *obj);
~~~~~~~~~~~~~~^~~
make[2]: *** [CMakeFiles/libucl_demo.dir/build.make:82:CMakeFiles/libucl_demo.dir/example_libucl.cc.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:95:CMakeFiles/libucl_demo.dir/all] 错误 2
make: *** [Makefile:103:all] 错误 2
this is my cmake file
`
cmake_minimum_required(VERSION 3.10...3.21)
project(libucl_demo CXX)
set(CMAKE_CXX_STANDARD 11)
set(SOURCE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/example_libucl.cc)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
find_package(ucl REQUIRED)
include_directories(${LIBUCL_INCLUDE_DIRS})
add_executable(${PROJECT_NAME} ${SOURCE_FILE})
target_link_libraries(${PROJECT_NAME} ucl::ucl)
`
this is my example file
`
#include
#include
#include <ucl.h>
int main(int argc, char **argv)
{
ucl_parser_t *parser = ucl_parser_new(0);
ucl_parser_add_file(parser, "config.conf");
const ucl_object_t *obj = ucl_parser_get_object(parser);
ucl_parser_free(parser);
const ucl_object_t *value = ucl_object_lookup_path(obj, "section.key");
if (value != NULL) {
const char *str_value = ucl_object_tostring(value);
printf("config value: %s\n", str_value);
}
ucl_object_unref(obj);
return 0;
}
`
The text was updated successfully, but these errors were encountered: