cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert C code to C++ in True Studio?

parth kothiya
Senior

file-> new-> convert C/C++ nature then build it gives error main.h no such fie or directory

1 ACCEPTED SOLUTION

Accepted Solutions
Markus GIRDLAND
ST Employee

There's a risk that you get a lot of errors after converting a project to c++. The first is, as you mentioned, that you need a main.cpp file. Also, I gave this explanation in another thread:

Includes and Symbols are not copied from C to C++ compiler automatically, it will require manual work.

Easiest way of doing this is by going here:

C/C++ Build > Settings > Tool Settings > C Compiler > Symbols.

Copy all lines to the corresponding C++ Compiler > Symbols.

Do the same batch copy for the Include paths.

View solution in original post

4 REPLIES 4
S.Ma
Principal

Generally speaking, when a file exist and it can't be found by the compiler or tool means the search path in the project setting is incomplete. Most of the time, the location of the project file is the default "." current directory,

as per your answer after converting in code to C++ in file path i need to change

main.c to main.cpp

location of my project file is default

Markus GIRDLAND
ST Employee

There's a risk that you get a lot of errors after converting a project to c++. The first is, as you mentioned, that you need a main.cpp file. Also, I gave this explanation in another thread:

Includes and Symbols are not copied from C to C++ compiler automatically, it will require manual work.

Easiest way of doing this is by going here:

C/C++ Build > Settings > Tool Settings > C Compiler > Symbols.

Copy all lines to the corresponding C++ Compiler > Symbols.

Do the same batch copy for the Include paths.

Thanks Markus for your support..

i had include all symbols and includes as you said above but still true studio not finding some header files ,files already present in directory i'm using software v9.0.0 hope it is fixed in v9.2.0