2013-09-13 03:56 AM
Hi
I have a problem concerning compiling my STM32L project. If i use an example from ST (since I'm using STM32L-Discovery board) VirtualComport_Loopback everything compiles without a problem (and the program functions as well). But when I try to implement that function (CDC USB communication) into my existing project, I get the Error: &sharp40: expected an identifier and error: &sharp65: expected a '';'' that refer to usb_type.h include which is a part of STM32_USB-FS-Device_Lib_V4.0.0. It is not altered in any way from the one I use with ST example. I've added all .h files that are inclued in the example into the project and I can't understand this...can some .h files be incompatible or what?
I know this is probably more of a Keil thing, but noone seems to have an idea in their forum...Thank you
#know-your-tools #stm32_usb-fs-device_lib_v4.0.02013-09-13 04:16 AM
Perhaps your project is not pulling the same include files as the one that works, check the Include Paths settings, and all the Defines passed to the preprocessor. Look at the project options metadata, and the dependency trees for the files in the source tree view.
Look carefully around the lines with the error, the error # is pretty useless to me without context.2013-09-17 07:07 AM
So, instead of applying various project settings (Include Paths, preprocessor defines, etc.) from CDC example to my project (they seem to be the same, anyway) I simplified things by making the example my base project. I just copied the essential main.c code to example's main.c file and, of course, copied a few of src and inc files into workspace map and...well, same errors come up.
Hasn't any1 had a similar problem here???2013-09-17 08:26 AM
Hasn't any1 had a similar problem here???
I think we've all encountered problems with compilers pulling the wrong include files and failing as a result. I know Keil will pull the wrong STM32 library includes (it's defaults) if it's not explicitly told to look elsewhere. You need to look at the dependency tree the compiler is working with, and you need to provide all the paths internal to the project so they are used ahead of the defaults, which almost always go to old/stale/wrong files. You should also be able to review the output of the preprocessor pass, which can also help you understand why an error occurred.2013-09-17 01:23 PM
Thank you for help, clive, but as i suspected there was an ''incompatibility'' in ST's libraries. I guess a more experienced programmer would tackle this one faster. There was another definition of TRUE and FALSE in discovery_lcd.h file, which usb_type.h tried to redefine with ''typedef enum''. I just don't know why compiler was stating it was ''expecting an identifier''; should it just declare a conflict with some other definition it would make sense right away.