header issues after converting C project to C++

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

header issues after converting C project to C++

1,334 Views
CK3
Contributor III

Hi,

I converted the dspi_half_duplex_int_master SDK for the K22F from a C project to a C++ Project according to this Guide: From C to C++: Converting Eclipse C Projects | MCU on Eclipse and this works. The example work and that's fine.

Now I want to integrate some external Code written in C++ into it. This includes a .h file and a .cpp file with classes that I want to adapt using some function from the dspi_half_duplex_int_master (Let's call them MyClass.h and MyClass.cpp). This leads to the following 2 Problems:

  1. MyClass.h includes <iostream>. When I include MyClass.h into my main file, I get the error message for the My.Class.h file "fatal error: iostream: no such file or directory". Even though MyClass.cpp is a C++ file.
  2. MyClass.cpp uses some functions from the duplex_master main file. I therefore include the necessary headers in the MyClass.h file. However, I am still confronted with the error "XXX was not declared in this scope" even though I included the necessary header-file. When looking in to these header files, I find that as soon as they are included in the MyClass.h they throw a ton of errror messages of various "... was not declared in this scope".

I came across this thread Solved: Issues with using C libraries with C++ files - NXP Community but have no libraries in the linker settings that I can switch around. Any ideas?

Kind regards!

 

0 Kudos
2 Replies

1,323 Views
converse
Senior Contributor V

No such problems here...

Is it *really* a C++ project. To check, open the project Properties, C/C++ Build->Settings - Is the MCU C++ Compiler shown?

Otherwise, can you export your project (or a version that reproduces the problem) and post it here, so that somebody can identify the issue.

0 Kudos

1,321 Views
CK3
Contributor III

Just checked the project settings. Yes, the MCU C++ Compiler is shown:

Unbenannt.PNG

0 Kudos