can't find definition of FT_LOAD_TARGET_LIGHT and FT_LOAD_NO_HINTING? - opencascade

when I compile Visualization folder, that is the error in Font_FTFont.cxx
I made the error go away by changing
#ifdef HAVE_FREETYPE
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
// changed to
#ifndef HAVE_FREETYPE
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
I don't know how to fix the error and whether my change has major hidden issues?

Related

Including this file causes a bunch of unknown type errors [C]

Including main.h in stm32f4xx_hal_uart.h causes issues --> usart_app.h:14:22: error: unknown type name 'USART_Handle_t'; did you mean 'DMA_Handle_t'? -- mainly related to unknown types.
Aren't there easy ways around figuring out issues specific to file includes? cause it's annoying
I suspect stm32f4xx_dma.h is causing trouble since it's being called in main.h and stm32f4xx_hal_uart.h but I wonder wouldn't header guard take care of the 'loop`?
here's what i sort of have:
// --- main.h ---
#include "stm32f4xx_hal.h"
#include "mcp9808.h"
#include "usart_app.h"
#include "stm32f4xx_dma.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
// --- stm32f4xx_hal_uart.h ---"
#include <stdint.h>
#include "stdbool.h"
#include "../Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc.h"
#include "stm32f4xx_dma.h"
#include "main.h" // ... adding this causes issues !!
typedef struct {
USART_TypeDef *pUSARTx;
USART_Config_t USART_Config;
USART_State USART_State;
char *txBuffer;
char *rxBuffer;
uint8_t txLength;
uint8_t rxLength;
uint8_t rxSize;
uint8_t dmaTransfer;
uint8_t dmaReception;
DMA_Handle_t *dmaRx;
DMA_Handle_t *dmaTx;
} USART_Handle_t;
// --- stm32f4xx_dma.h ---
#include "stm32f401xe.h"
#include "stm32f4xx_hal.h"```
… I wonder wouldn't header guard take care of the 'loop`?
What header guard? The file contents you show in the question do not have header guards.
If there are header guards, then the problem is that including main.h in stm32f4xx_hal_uart.h causes it to include usart_app.h, and usart_app.h needs the USART_Handle_t defined in stm32f4xx_hal_uart.h, so it includes stm32f4xx_hal_uart.h, but the earlier processing is already past the header guard in stm32f4xx_hal_uart.h, so the guard skips the body of stm32f4xx_hal_uart.h when usart_app.h includes it, so USART_Handle_t is not defined.
To fix that, do not include main.h in stm32f4xx_hal_uart.h.

Getting error unknown type name 'size_t' even though I've included the relevant C libraries and headers

Please find my code below.
I am getting the error "/usr/include/linux/sysctl.h:40:2: error: unknown type name ‘size_t’"
Searching online, the only suggestion is to make sure you have stddef.h included in your code, which I do as can be seem below. There does not appear to be a solution available outside of this fix, which I have tried, so I am currently at a loss as to how to move forward.
Also note, this code is not pretty, but that is not the main issue with this thread. The error I am getting does not look like it is being thrown from a mistake in my code, but I may be wrong.
#include <linux/netfilter_ipv4.h>
#include <linux/netfilter.h>
#include <linux/ip.h>
#include <linux/tcp.h>
#include <sys/types.h>
#include <linux/module.h>
#include <stddef.h>
struct nf_hook_ops{
struct list_head *list;
nf_hookfn *hook;
struct module *owner;
u_int8_t pf;
unsigned int hooknum;
int priority; /* Hooks are ordered in ascending priority. */
};
int nf_register_hook(struct nf_hook_ops *reg);
void nf_unregister_hook(struct nf_hook_ops *reg);
struct nf_hook_ops nfho = {
nfho.hook = hook_func_in,
nfho.hooknum = NF_INET_LOCAL_IN,
nfho.pf = PF_INE,
nfho.priority = NF_IP_PRI_FIRST
};
nf_register_hook(&nfho); // Register the hook
C is parsed strictly top to bottom, and #include does plain old textual inclusion, not anything clever that would qualify for the name of "module import". Therefore, the order of #include directives can matter. In this case, you're getting complaints about a type defined by stddef.h, so you must make sure that stddef.h is included before whatever needs it, which could be (indeed, is) another header file.
I can reproduce the error you're getting with the following two-line source file:
#include <linux/sysctl.h>
#include <stddef.h>
→
$ gcc -fsyntax-only test.c
In file included from test.c:1:0:
/usr/include/linux/sysctl.h:39:2: error: unknown type name ‘size_t’
If I exchange the order of the #include lines,
#include <stddef.h>
#include <linux/sysctl.h>
then there is no error. This is a bug in linux/sysctl.h, but I would not hold my breath for it to be fixed. I recommend moving stddef.h to the very top of the include list.
I can not reproduce the problem with your actual list of includes,
#include <linux/netfilter_ipv4.h>
#include <linux/netfilter.h>
#include <linux/ip.h>
#include <linux/tcp.h>
#include <sys/types.h>
#include <linux/module.h>
#include <stddef.h>
but a gcc -H dump does not show linux/sysctl.h getting pulled in transitively by that set of includes, so probably it's just that I have a different version of the kernel headers on my Linux box than you do.

C program for GCC and MS Visual Express C++ works only for GCC

I'm trying to make my school assignment to work in both GCC and MS VS enviroments, but for some reason, it fails to compile in MS VS...
The errors are:
warning C4627: '#include ': skipped when looking for precompiled header use - Add directive to 'Stdafx.h' or rebuild precompiled header
or
unexpected #endif (the one after #include "Stdafx.h")
or
When I put the "Stdafx.h" header to first line, it behaves like there's no stdio and everything (HANDLE, int, etc. ) is illegal declaration.
#include <stdio.h>
#include <stdlib.h>
#ifdef _MSC_VER
#include "Stdafx.h"
#include <windows.h>
#endif // _MSC_VER
#ifdef __GNUC__
#include <unistd.h>
#endif // __GNUC__
#ifdef _MSC_VER
int main ()
{
printf("___MS VS Studio/Express compiler___\n");
/*some stuff here*/
return 0;
}
#endif //_MSC_VER
#ifdef __GNUC__
int main()
{
printf("___GCC compiler___\n");
/*some other stuff here*/
return 0;
}
#endif // __GNUC__
It works fine on GCC and I suspect it has something to do with the #includes in #ifdef conditions in MS VS, but I dunno how to do it correctly..
Can anyone please correct me on how to make this work properly?
Any useful advice welcome, thanks!
Your file should start like below, the "stdafx.h" file must be included first. This is required by Visual Studio's "precompiled headers" feature.
#ifdef _MSC_VER
#include "Stdafx.h"
#include <windows.h>
#endif // _MSC_VER
#include <stdio.h>
#include <stdlib.h>
#ifdef __GNUC__
#include <unistd.h>
#endif // __GNUC__
If this doesn't workmtry to do launch the Build - Rebuild Solution command.
If this doesn't work you can remove the precompiled header like this:
Launch the Project - Properties command
In the C/C++ - Precompoiled Headers tab click on "Precompiled Headers" and select "Not Using Precompiled Headers".

Type from included header not found

I have a weird problem with my C-Code that I don't really understand.
I have two header files os_memory.h and os_mem_drivers.h.
os_memory.h
#ifndef OS_MEMORY_H_
#define OS_MEMORY_H_
#include "lcd.h"
#include "os_mem_drivers.h"
static const MemAddr gui_alloc_table_start = 0x1C8;
#endif /* OS_MEMORY_H_ */
os_mem_drivers.h
#ifndef OS_MEM_DRIVERS_H_
#define OS_MEM_DRIVERS_H_
#include "os_memory.h"
#include "defines.h"
#include "os_core.h"
typedef uint16_t MemAddr;
#endif
If I try to compile this code the compiler gives me the error unknown type name 'MemAddr'. I don't get it because I included the right header files in each .h file so there shouldn't be any error.
Is there anything that I'm missing here?
I'm using AtmelStudio 6.1 and the C language for this project.
You should move the definition for type MemAddr before including "os_memory.h":
os_mem_drivers.h:
#ifndef OS_MEM_DRIVERS_H_
#define OS_MEM_DRIVERS_H_
#include <stdint.h>
typedef uint16_t MemAddr;
#include "os_memory.h"
#include "defines.h"
#include "os_core.h"
#endif
But a more important problem is the circular inclusion of "os_memory.h" and "os_mem_drivers.h". Each one includes the other: include guards prevent recursive inclusion but make it difficult to understand what is really going on. You should try and fix this issue.

Issue with organizing a large project with .c and .h files

So I have quite a lot of .c and .h files in my project:
Here are just the headers of the files that are having an issue:
#ifndef OUTPUTUTILITIES_H
#define OUTPUTUTILITIES_H
#include <string.h>
#include <stdio.h>
#include "parser.h" // <== IF I REMOVE THIS include everything works. But I need to include this here
#endif
#ifndef PARSER_H
#define PARSER_H
#include <stdbool.h>
#include <stdio.h>
#include "utilities.h"
#endif
#ifndef UTILITIES_H
#define UTILITIES_H
#include <string.h>
#include <stdio.h>
#include "variableVector.h"
#endif
#ifndef VARIABLEVECTOR_H
#define VARIABLEVECTOR_H
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#endif
Can someone please explain why I cannot #include "parser.h" file in my outputUtilites.h file? And also what are the general principles behind organizing your import .h files?
I also wanted to let you know that in the corresponding .c file I only include the corresponding .h file and nothing else. For example in my parser.c file I ONLY include parser.h and in my ouputUtilities.c file I ONLY include outputUtilities.h file.

Resources