In the folder with all my C-files I include the headerfile pic32mx.h in my c-files
#include <pic32mx.h>
But when compiling any of those c-files I get the error
fatal error: 'pic32mx.h' file not found
I went into the json-file of the folder (called c_cpp_properties.json) to set the includePath for the headerfile like this (I added the second path):
"includePath": [
"${workspaceFolder}/**",
"/Applications/mcb32tools.app/Contents/Resources/Toolchain/include"
],
Yet I still get the error of not being able to compile the program, the header file is not found. I am running GCC on Mac OS and the IDEA is Visual Studio Code.
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'm working with Arduino and Teensy boards from inside VS code. I can build and program everything fine, but the highlighting and code following functions built into VS Code don't work.
Previously, my custom headers weren't loading or highlighting, but this answer got that working for me. Now I have the right libraries on my include path (and I can click and follow them to the correct source) but some names still don't work:
My includePath appears to be configured correctly, as I mentioned I can follow the includes and it opens the correct sources:
"includePath": [
"${workspaceFolder}/**",
"C:/Program Files (x86)/Arduino/**",
"C:/Program Files (x86)/Arduino/hardware/teensy/avr/cores/teensy/**",
"C:/Program Files (x86)/Arduino/hardware/teensy/avr/libraries/ADC/**",
"C:/Program Files (x86)/Arduino/hardware/arduino/avr/cores/arduino/**",
"C:/Program Files (x86)/Arduino/hardware/arduino/avr/variants/standard/**",
"C:/Program Files (x86)/Arduino/hardware/tools/avr/lib/gcc/avr/5.4.0/include/**"
]
I can confirm the header is on the includePath and has the names defined I'm looking for:
Somehow VS Code is still saying the identifier is undefined.
Any ideas?
Just install the Arduino extension and run vscode command Arduino: initialize. You will need to select board and
File .vscode\c_cpp_properties.json and .vscode\arduino.json will automatically created.
I am trying to compile a code that I downloaded from GitHub https://github.com/severinson/VLC-driver on Eclipse CDT 3.8.1 and using ubuntu 16.04 and kernel version is 4.13.0-041300-lowlatency (because this project works on Xenomai Kernel) and getting this error:
fatal error: asm/linkage.h: No such file or directory,
external location: /usr/src/linux-headers-4.13.0-041300-lowlatency/include/linux/linkage.h C/C++ Problem
and unresolved inclusion for the header files:
#include <asm/uaccess.h>
#include <asm/io.h>
I searched for this error on various website, I came to know that I have to make some changes to Makefile and there is no asm directory in /usr/src/linux-headers-4.13.0-041300/include, instead there is a directory named asm-generic.
Can someone help me to resolve this error and the unresolved inclusions?
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
I'm trying to compile the source of sqlite3.c and shell.c I downloaded from the SQLite website using Visual Studio 2015. I created DLL project sqlite3 and put the sqlite3.c source into it. Then I created project sqlite3shell and put shell.c source into it. I added include "stdafx.h" into both. When I compiled both projects the DLL did not produce a .lib file, so the compile of sqlite3shell got the error LNK1104 cannot open sqlite3.lib.
I manually created a .lib file using this solution. Then the sqlite3shell program compiled successfully. But when I went to run the program, I got the error The application was unable to start correctly (0xc000007b). Looking into this error is seems one reason it could be caused is by trying to access a 64-bit program from a 32-bit program. But everything was created using the x86 configuration.
Is there some way to have the DLL compile produce the correct .lib file? Or if that won't fix the problem, is there something I can do to prevent the 0xc000007b error?
In case someone else should have this problem, I have found the solution. There were 2 lines that specified the define of SQLITE_API. I added the export to the define like this: # define SQLITE_API __declspec(dllexport). Apparently there were no exports, so that was why the .lib file was never created. With the change, the .lib and .exp files were created and then the program didn't get the 0c000007b error.