Programming in c++

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User7784
Level 2
Level 2
Hello,

when can we expect, that it is possible,
to make a projekt in c++ for using classes etc?

Thank you.
0 Likes
4 Replies
Not applicable
Hi,

Pls follow up with eTicket 26964729 if you are referring to this similar case.

Best regards,
Sophia
0 Likes
User7784
Level 2
Level 2
Hello Sophia,

I mean it generally.

I tried to make c++ Projects.

But i got serveral problems.

if I make a Dave-project, which
has only a main.cpp and main.hpp as
start-unit, i could import "Dave3.h",
i could compile, but when i start
the project, my Interruptfunction in main.cpp,
which i have registered in the NVIC002-App,
would not be called by the Timer.

if i make a Dave-project, which has
main.c as start-unit and call in main-fkt
of main.c a function of a cpp-File, so
the timer is working.
But if i, try to import "Dave3.h" a cpp-File,
i got many errors like "multipe declarations .." etc.
So in a cpp-file i could not use functions like
"IO004_SetOutputValue(IO004_Handle5,1);"

Dou you have a solution for me or a example, which
describes the using of c++ in dave-project?

Thank you.

Best regards,
HiSH
0 Likes
User7784
Level 2
Level 2
Hello there.

Could the Infineon Team give me an answer to my last Thread?

Best regards,

HiSH
0 Likes
Not applicable
In a .cpp file, you have to include c headers like this:

extern "C"
{
#include
}


Since Dave maps all interrupt handler to c functions, you have to declare your interrupt handler as c functions within your .cpp files like this:

extern "C" void InterruptHandler()
{
...
}


Feel free to ask, if you have any further C++ problems. It may not be official supported, but until now I found a solution for every issue regarding C++ integration in Dave3. Actually it is not absolutely easy to use C++ with the App Library and the Dave3 Toolchain, but it works and it's still worth the effort.

Cheers, Felix

P.S.: Sorry for any spelling or grammar mistakes - I'm no native speaker.

Edit: Some additional informations about mixing C and C++: http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html
0 Likes