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
Related
Question: where do I get and how do I make strsafe.h work with Tiny C Compiler by Bellard.
Here is my Journey with MinGW header files, which is unsuccessful,
as I was unable to make strsafe.h headers of MinGW work with Tiny C Compiler.
The beginnings.
I wanted to run/compile some text-editor project written in C and
suddenly strsafe.h header was missing in the Tiny C Compiler \include folder.
jittey-main>tcc -run main.c
main.c:4: error: include file 'strsafe.h' not found
strsafe.h header seems to not be included in the Tiny C Compiler.
So I tried to download strsafe.h header from mingw project (strsafe.h)
I placed it into the /include folder and suddenly another missing header file poped up.
tcc -run main.c
In file included from main.c:4:
other/strsafe.h:9: error: include file '_mingw_unicode.h' not found
Alright, I tried to find _mingw_unicode.h in the mingw project.
And here I found it:
mingw project (_mingw_unicode.h)
I placed it into /include folder just like before.
tcc -run main.c
In file included from main.c:4:
other/strsafe.h:13: error: include file 'specstrings.h' not found
Once again I was welcomed with another missing header file.
Here it is: mingw project (specstrings.h)
I placed it into /include folder just like before.
tcc -run main.c
In file included from main.c:4:
In file included from other/strsafe.h:13:
other/specstrings.h:12: error: include file 'sal.h' not found
Now this is getting repetitive... Alright It's here.
mingw project (strsafe.h)
I placed it into /include folder just like before.
Last one to resolve? I hope so.
tcc -run main.c
In file included from main.c:4:
In file included from other/strsafe.h:13:
other/specstrings.h:336: error: include file 'driverspecs.h' not found
Here it is: mingw project (driverspecs.h)
I placed it into /include folder just like before.
Slight change in errors. strsafe.h header contains C++ syntax? I'm stuck here.
From this error I guess that strsafe.h header from the MinGW project is not compatible with C89 C99 or C11 languages.
tcc -run main.c
In file included from main.c:4:
other/strsafe.h:131: error: ',' expected (got "dwFlags")
The exact error line can be found here: strsafe.h:131: error
I don't know what to do now.
This is incomplete answer.
Does not answer how to setup TCC with windows-10-sdk.
Location of strsafe.h
I did some research and I've found that strsafe.h is part of windows-10-sdk
The setup file of windows-10-sdk is named winsdksetup.exe
The setup size is unexpectedly small. (1,29 MB)
However, the setup downloads and produces additional (1,86 GB) after installation.
windows-10-sdk gets installed into this directory by default:
C:\Program Files (x86)\Windows Kits\10
After installation of windows-10-sdk
The location of strsafe.h is here:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared\strsafe.h
The strsafe.lib file can be found here:
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x86\strsafe.lib
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x64\strsafe.lib
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\arm64\strsafe.lib
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\arm\strsafe.lib
10.0.19041.0 is a version number of windows-10-sdk.
x86 x64 arm64 arm are the instruction set architectures.
Some additional required .h headers can be found here
C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\
Further failure to compile using Windows SDK
I had some trials to compile the previously mentioned text-editor project.
I found some instructions regarding compiling the project
with other compilers rather than Tiny C Compiler
I tried Linking the include .h headers of Windows SDK
tcc main.c "-IC:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared"
But it still came out as a failure.
I received the following errors:
jittey-main>tcc main.c "-IC:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared" "-LC:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x86"
In file included from main.c:4:
In file included from c:/users/juozas/desktop/latest-built/include/winapi/windows.h:66:
In file included from C:/Program Files (x86)/Windows Kits/10/Include/10.0.19041.0/shared/windef.h:1:
C:/Program Files (x86)/Windows Kits/10/Include/10.0.19041.0/shared/winapifamily.h:226: warning: WINAPI_FAMILY_PARTITION redefined
In file included from main.c:4:
In file included from c:/users/juozas/desktop/latest-built/include/winapi/windows.h:67:
c:/users/juozas/desktop/latest-built/include/winapi/winbase.h:150: error: ';' expected (got "WINBOOL")
I suspect this error might be showing that the windows.h that already exists in Tiny C Compiler and is incompatible with the headers of Windows SDK.
I think Tiny C Compiler requires modified headers of Windows SDK, that could merge well.
Back to MinGW
After installation of Windows SDK and linking the .lib files.
As the same headers problems still occur and persist.
I think setting up TCC with MinGW might be worth a try.
One more suggestion is to re-compile Tiny C Compiler with MinGW headers.
But I'm not sure about that, not sure if it would do anything.
But I might try at some less busy day.
Compiling a file with TCC on windows with a library from C99
I am using MinGW version 4.5.2 on windows 10. I am trying to link multiple libraries to a project in VS code. When I try run this command: g++ main.c -o main.exe -I"C:\\Users\\USER\\Programming\\OPenGL Library\\glfw\\include\\glfw3.h" -L"C:\\Users\\USER\\Programming\\OpenGL Library\\glfw\\lib-mingw-w64\\". I get a compile error: main.c:2:24: fatal error: GLFW\glfw3.h: No such file or directory What is wrong with the command above that gives this linking error. As far as I can tell I have pointed MinGW to the library and specified the header file. I am not sure what else I need to add to the command for link the GLFW library as well as other libraries such as GLEW or glm.
If your include directive looks like
#include <GLFW/glfw3.h>
you need to supply a path to a directory which itself contains a directory named GLFW.
I want to use a library in C so I've downloaded it (libsodium) and I'm trying to use it with a simple program and I cannot make Codeblocks to recognise it.
I get the following error
libsodium.la: file not recognized: file format not recognized
collect2.exe: error: ld returned 1 exit status
My Specs:
Architecture x64
Codeblocks
Windows 10
MinGW
I'm using the pre-builts available in the library resources and copying them into MinGW local folder and binding them to the linker following a codeblocks tutorial
What am I possibly doing wrong?
Was the prebuilt library also x64?
Did you link with the .la file instead of the .a file by mistake?
In Code::Blocks add the path where libsodium.a is to the library search path and add sodium as a library (or -lsodium as linker flag)
Have you tried building libsodium yourself? If you have MSYS2 it's not that hard:
# change the following line to the location where you want to install libsodium
INSTALLPREFIX=/usr/local
./configure --prefix=$INSTALLPREFIX --enable-blocking-random LDFLAGS="-Wl,--as-needed -lssp" &&
make install-strip &&
echo Success
PBC library is installed in my system and I want to use it in my C program in Eclipse. So, I passed the include path and library path of PBC to the compiler. Later, when I try to build the program it gives the following error:
cc1: fatal error: /usr/local/include/pbc: No such file or directory
I need help in building a binary file with the help of cmake toolchain file
I have the below structure
lib also included with header files
examples/dir1/dir2/dir3/dir4/demo -- will contain the Demo by using those src nd header files.
I was able to build library(.a) file with the include and lib
But not knowing how would I able to build the binary for the demo
****toolchain file**********
add_subdirectory(examples)
error:
CMake Error at examples/CMakeLists.txt:1 (collect):
Unknown CMake command "collect".
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!