Questions tagged [c-header]

In modern C, header files are crucial tools that must be designed and used correctly. They allow the compiler to cross-check independently compiled parts of a program.

34 questions
0
votes
0 answers

XCode 13, cannot add a search path for .h files

I'm having trouble adding raylib.h to my project in Xcode 13. The website gives the following instructions: Make sure Xcode finds raylib.h: Go to Build Settings > Search Paths and add raylib header folder (raylib-master/src) to Header Search…
0
votes
1 answer

how to use gcc to preprocess header only for #ifdef, not for #include and #defines

I have to preprocess a header, during this I want to only process the header for #ifdef, #if defined sections, other sections like Macro expansion and #include sections should not be expanded or checked. how to get this? I need to pass this output…
0
votes
2 answers

how to not include certain functions in a header file for use in C programing

To paint the picture let's imagine we have a header called headertest.h and where going to use it in a file called test.c It's context look like this #include extern size_t string_lenght(const char *); size_t string_lenght(const char…
user19139723
0
votes
0 answers

What does __kernel_size_t data type in C header file mean?

I was looking thought the string.h header file when I found a data type called __kernel_size_t. I couldn't find anything of interest about it's meaning so I'm asking here. I'm running linux and it's location is…
user19139723
0
votes
0 answers

python c api with multiple file

While writing python c api, I wanted to separate it into multiple files. So, I separated the files (module.cpp and support.cpp) and wrote the function declarations in the separate files (support.h). But how to write setup.py? ├── cpp │ ├──…
tsp
  • 61
  • 7
0
votes
0 answers

Can't pass array stored in .h file to C function

I am trying to implement a driver for a sensor(ST-VL53L5CX) on an AVR MCU (AVR128DB48). The driver comes prewritten, with a few I2C functions for the user to fill in (So the sensor can be implemented on different platforms). The driver is made up of…
D_A
  • 1
  • 1
0
votes
1 answer

Use typedef struct in another file in C

Hello, I'm new to C. I want to "export" and use a typedef struct in other files but it seems that it doesn't works a lot. I have those kind of errors unknown type name 'CAN_frame' storage size of 'CAN_RxMessage' isn't known invalid use of undefined…
Gabriel
  • 25
  • 1
  • 5
0
votes
1 answer

How To Include Header Files In C

I don't know how to include my own header files in my source file. I declare addition in my header file(myhead.h): int addition(int a, int b); In the source file I define it(myhead.c): int addition(int a, int b){ return a+b; } In the third…
bunderbah
  • 5
  • 4
0
votes
2 answers

gcc "undefined reference to"

I'm having trouble finding why my program wont compile. Im not very good at C so I hope someone can spot my error. I was told it was probably a header issue, that is why I'm starting with this. This is the…
Ceeerson
  • 189
  • 8
0
votes
1 answer

Compile C with subdirectory based on compiler constant

I want to make a program which includes source files and header files from a sub-directory in addition to the main directory. The name of the sub-directory, and parts of the filenames themselves need to be chosen with a compiler constant. Here's an…
0
votes
1 answer

Is it possible to manage indirect .h dependencies with 'touch' command?

It is advised to use -MM option to manage indirect dependencies in headers. Why we don't use touch command. Am I missing anything here, or just it's because it's a hack and we want to keep the real last modification of timestamp (look like intrusive…
rafoo
  • 1,506
  • 10
  • 17
0
votes
1 answer

Form C header file "'vector' file not found" error happening into swift

I am trying to integrate an Objective-C SDK into my swift file. But when I want to add some of the files from the SDK into my Bridging Header I am getting this error 'vector' file not found I am also getting string file not found if I want to add…
0
votes
1 answer

C and the file

My simple program compTest.c #include #include int main(void) { double complex z = 1.0 + 1.0 * I; printf("|z| = %.4f\n", cabs(z)); return 0; } When using the standard library and compiling with gcc on a Linux…
Jay
  • 75
  • 1
  • 9
0
votes
1 answer

Cython: calling C function throws 'undefined symbol'

I am attempting to use the LMDB C API with Cython. I want to import the following definitions from the header file: typedef struct MDB_env MDB_env; int mdb_env_create(MDB_env **env); So I created a .pxd file: cdef extern from 'lmdb.h': …
user3758232
  • 758
  • 5
  • 19
0
votes
3 answers

How to make a function visible through a header file in C

I have several header files in a library: header1.h, header2.h... I also have a general header file for the library: mylib.h I want the user to import the main.h file and get access to only some of the functions in the other header files. For…
Octan
  • 348
  • 4
  • 19