0

I'm trying to test the libwebsockets API https://github.com/warmcat/libwebsockets/tree/master/minimal-examples/api-tests/api-test-lws_tokenize

Whenever I type

cmake . && make

to build the code. I got following error.

Scanning dependencies of target lws-api-test-lws_tokenize 
[ 50%] Building C object CMakeFiles/lws-api-test-lws_tokenize.dir/main.c.obj
C:\Users\pro12\Desktop\New folder (2)\libwebsockets\minimal-examples\api- 
tests\api-test-lws_tokenize\main.c:16:27: fatal error: libwebsockets.h: No 
such file or directory
#include <libwebsockets.h>
                       ^
compilation terminated.

My question is where to add libwebsockets.h file? I have mingW installed and i'm using gcc compiler. I have libwebsockets build downloaded from here https://ci.appveyor.com/project/lws-team/libwebsockets which is placed at C:\Program Files (x86)/libwebsockets

Tim Paine
  • 11
  • 5
  • Okay doing it @AjayBrahmakshatriya – Tim Paine Oct 17 '18 at 16:36
  • Can you also specify how you built and installed the libwebsockets project? – Ajay Brahmakshatriya Oct 17 '18 at 16:38
  • Edited @AjayBrahmakshatriya – Tim Paine Oct 17 '18 at 16:45
  • the issue is that you are using MinGW's compiler which won't be able to pick the include files from `C:/Program Files (x86)/libsockets` (I also think it cannot use the binaries built for windows). You can build libwebsockets from source using the instructions [here](https://github.com/warmcat/libwebsockets/blob/master/READMEs/README.build.md). You can follow the instructions from the section for MinGW. -- Search for "@section cmwmgw Building on Windows (MinGW)" on that page. – Ajay Brahmakshatriya Oct 17 '18 at 16:54
  • @AjayBrahmakshatriya I'm trying your mentioned method. Can you make clear what to put in place of those two dots in command `cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=C:/MinGW ..` – Tim Paine Oct 18 '18 at 13:16
  • I have tried putting the source code directory of libwebsockets but it is not working. Can you make clear how to put this? – Tim Paine Oct 18 '18 at 13:17
  • I'm running commands from below mentioned directory. `CMake Error: The source directory "C:/Users/pro12/Desktop/libwebsockets/build" does not appear to contain CMakeLists.txt.` – Tim Paine Oct 18 '18 at 13:18
  • The dots have to exactly the same in the command. It means parent directory. This assumes that you have made the build directory inside the source directory and you are providing the path to the source directory from the build directory. The errors you are getting are also for the same reason. Make sure you are running the cmake command from the build directory which is directly inside the source directory. – Ajay Brahmakshatriya Oct 18 '18 at 15:17
  • After doing what you said i'm getting this : `CMake Error at C:/Program Files/CMake/share/cmake-3.13/Modules/CMakeTestCCompiler.cmake:52 (message): The C compiler "C:/MinGW/bin/gcc.exe" is not able to compile a simple test program. It fails with the following output: Change Dir: C:/Users/pro12/Desktop/lib/libwebsockets/CMakeFiles/CMakeTmp` – Tim Paine Oct 18 '18 at 16:10
  • You seem to be having issue while building libwebsockets. You should probably direct them directly to the maintainers/authors of the repository. It would require a knowledge of the repository to fix it. Which I sadly do not have. – Ajay Brahmakshatriya Oct 18 '18 at 16:57

0 Answers0