Code Monkey home page Code Monkey logo

Comments (3)

jwhui avatar jwhui commented on July 3, 2024

Did you add #include <openthread/ip6.h> to the top of the file?

from ot-nrf528xx.

lancersky avatar lancersky commented on July 3, 2024

Yeah, I also tested this. But the same error.

diff --git a/examples/apps/cli/main.c b/examples/apps/cli/main.c
index 4d0440c12..b156a7ae4 100644
--- a/examples/apps/cli/main.c
+++ b/examples/apps/cli/main.c
@@ -33,6 +33,7 @@
 #include <openthread/cli.h>
 #include <openthread/diag.h>
 #include <openthread/tasklet.h>
+#include <openthread/ip6.h>
 #include <openthread/platform/logging.h>
 
 #include "openthread-system.h"
@@ -130,6 +131,9 @@ pseudo_reset:
 
     otAppCliInit(instance);
 
+    otIp6SetEnabled(instance, true);
+    otThreadSetEnabled(instance, true);
+    
 #if OPENTHREAD_POSIX && !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
     otCliSetUserCommands(kCommands, OT_ARRAY_LENGTH(kCommands), instance);
 #endif

from ot-nrf528xx.

lancersky avatar lancersky commented on July 3, 2024

Hi, I solved it by modifying the following code. Thanks a lot.

diff --git a/examples/apps/cli/ftd.cmake b/examples/apps/cli/ftd.cmake
index f5a2870f8..e212e27e3 100644
--- a/examples/apps/cli/ftd.cmake
+++ b/examples/apps/cli/ftd.cmake
@@ -31,6 +31,10 @@ add_executable(ot-cli-ftd
     main.c
 )
 
+target_compile_definitions(ot-cli-ftd PRIVATE
+    OPENTHREAD_FTD=1
+)
+
 target_include_directories(ot-cli-ftd PRIVATE ${COMMON_INCLUDES})
 
 if(NOT DEFINED OT_PLATFORM_LIB_FTD)
diff --git a/examples/apps/cli/main.c b/examples/apps/cli/main.c
index 4d0440c12..9af1b4f6b 100644
--- a/examples/apps/cli/main.c
+++ b/examples/apps/cli/main.c
@@ -33,7 +33,10 @@
 #include <openthread/cli.h>
 #include <openthread/diag.h>
 #include <openthread/tasklet.h>
+#include <openthread/ip6.h>
 #include <openthread/platform/logging.h>
+#include <openthread/thread.h>
+#include <openthread/thread_ftd.h>
 
 #include "openthread-system.h"
 #include "cli/cli_config.h"
@@ -130,6 +133,11 @@ pseudo_reset:
 
     otAppCliInit(instance);
 
+#if OPENTHREAD_MTD || OPENTHREAD_FTD
+    otIp6SetEnabled(instance, true);
+    otThreadSetEnabled(instance, true);
+#endif
+
 #if OPENTHREAD_POSIX && !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
     otCliSetUserCommands(kCommands, OT_ARRAY_LENGTH(kCommands), instance);
 #endif
diff --git a/examples/apps/cli/mtd.cmake b/examples/apps/cli/mtd.cmake
index 7b71883bb..93c20b9a6 100644
--- a/examples/apps/cli/mtd.cmake
+++ b/examples/apps/cli/mtd.cmake
@@ -31,6 +31,10 @@ add_executable(ot-cli-mtd
     main.c
 )
 
+target_compile_definitions(ot-cli-mtd PRIVATE
+    OPENTHREAD_MTD=1
+)
+
 target_include_directories(ot-cli-mtd PRIVATE ${COMMON_INCLUDES})
 
 if(NOT DEFINED OT_PLATFORM_LIB_MTD)

from ot-nrf528xx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.