VS2019 LNK2001 Error

Hello everyone,

I am quite new to the LVGL however trying to follow the tutorial series and forums. I’m having a simulation problem on fonts and icons. I did every step the tutorial follows and checked my code and everything yet the VS2019 gives me a linker error (LNK2001) when i try to add my generated .c file from fontawesome and LVGL font generator. I used LV_FONT_DECLARE(arrows_20); command to call it to my style tab but the error occured.

I have searched the forum topics but couldn’t find anything related. I am stucked and any help would be appreciated.


Maybe look at the cmake file. Make sure your font .c file is selected there. Not sure this will work but just a suggestion.

Thank you for your interest. I guess the error is occured because of the main file. The VS2019 forces the main to compile it as a cpp file. So i wasn’t able to add .h files without linker errors. However, i changed the .cpp to .c and .h files are now included without any linker issues. But this time the simulator’s command prompt tells me there is an error as follows;

Checked the web but again nothing worked!

For the record,

I’ ve found out what caused that. VS19 tries to compile the project as it is a .cpp file. There was a problem at the very beginng which is actually the main.cpp wasn’t able to include my written .h files and i basically made a mistake by including written .c file. I didn’t really care about that as long as it worked but at some point this things can be a headache and make it harder to find out. However when it needs to link multiple files like fonts, images etc. the VS gave linker errors. Very quick solution that i made is to modify my written .h files with extern C command. That way you only need to include the header then you can call the function you wrote.

I know its a very beginner mistake to be made but lack of programming experience led this to happen :slight_smile: