Problem with include of standard headers

51 views
Skip to first unread message

alex

unread,
Aug 30, 2021, 2:27:08 AM8/30/21
to YAKINDU User
Hello
1- I have added the standard library paths via "Paths and Symbols -> Includes" menu
2- I have imported (included) the stdio.h header file in the definition section of my statechart model (the content assist correctly helps here)
3- When i try to call the printf function in my model (e.g. as a reaction in the entry of a state) I encounter the following problems
3-1- the content assist fails and does not show/auto complete the "printf" function
3-2- further, the following problems are reported:
        Access to feature '' has no effect
        Could not find declaration of 'printf'
4-It seems this problem is similar to the problem reported in this link 

Question:
Q1: How can i use the standard library functions like "printf" in my model?
Q2: How should i add the standard library header files to my project ? (via "Paths and Symbols -> Includes" menu OR some other way)

Thanks a lot in advance

Thomas Kutz

unread,
Aug 30, 2021, 3:21:08 AM8/30/21
to YAKINDU User
Hi Alex,

this should actually work. When you create a C project, you usually don't need to add the standard library paths via "Paths and Symbols -> Includes". This should work out of the box. You can check if you can create a header file, include <stdio.h> and use printf. If that does not work, it is a problem with your project configuration, if it does work, then try to close/open the project again.

Best regards,
Thomas Kutz

alex

unread,
Aug 30, 2021, 10:27:50 AM8/30/21
to YAKINDU User
Hi,

Thanks for your input. it directed me in the right path to solve the problem. Yet any thoughts on what might have caused the problem in item 5 !?

It seems the problem was with the eclipse not recognizing the toolchain
1- I added the path to my toolchain to the PATH env variable
2- restarted the eclipse
3- *** and now as you mentioned i could IMPORT the stdio.h header file (without requiring to manually add the INCLUDEPATH)
4- and subsequently i could call the functions in the header file
4-1- at this stage i created a sample c/c++ project and added the stdio.h and simply used printf("hello world)
BUT
5-1- I dont know why but at first the content assist in the statechart would not recognize printf and consequently using it resulted in an error
5-2- I used the puts function instead (which the content assist) did recognize and it worked (integrated the statemachine with the c++ application, compiled and run it successfully)
5-3- all of the sudden the printf function became available via the content assist and worked as expected

- I mentioned the steps above in case it might help someone

Thomas Kutz

unread,
Aug 30, 2021, 11:12:34 AM8/30/21
to YAKINDU User
This sounds indeed a bit strange. Hard to reproduce as it works for me out of the box.
Reply all
Reply to author
Forward
0 new messages