C++ files are not added to makefile

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

C++ files are not added to makefile

Jump to solution
4,523 Views
villevallinder
Contributor II

I have created an S32DS project for MPC5748G, running S32 design studio for power 1.0.

When I add a new C++ source file using template, the file is not included in the build process.

The new file shows up in the file tree but analyzis of the generated "Debug/src/subdir.mk" file shows that the new file has not been added.

The same thing happens if I try to import an existing file.

Adding a C-file from template works just fine.

Labels (1)
Tags (2)
0 Kudos
Reply
1 Solution
4,072 Views
stanish
NXP Employee
NXP Employee

Hello Ville,

Thanks for the additional details!

I'm now able to reproduce the issue you described.

It seems that you created a C project instead of C++ by the project wizard.

Such a project does not accept .cpp file as a source file and therefore there is no tool associated with .cpp file.

On the other hand a C++ project accepts both .c and .cpp source files.

I'd recommend you to create a new project and change the Language to C++ (see the screenshot below):

S32DS_Power_create_CPP_project.png

This project should accept .cpp files without any problem.

Hope it helps.

Stanislav

View solution in original post

5 Replies
4,073 Views
stanish
NXP Employee
NXP Employee

Hello Ville,

Thanks for the additional details!

I'm now able to reproduce the issue you described.

It seems that you created a C project instead of C++ by the project wizard.

Such a project does not accept .cpp file as a source file and therefore there is no tool associated with .cpp file.

On the other hand a C++ project accepts both .c and .cpp source files.

I'd recommend you to create a new project and change the Language to C++ (see the screenshot below):

S32DS_Power_create_CPP_project.png

This project should accept .cpp files without any problem.

Hope it helps.

Stanislav

4,074 Views
villevallinder
Contributor II

Hello Stanislav,

That was in fact the case.

It works fine now.

Thanks a lot!

Ville

0 Kudos
Reply
4,074 Views
villevallinder
Contributor II

The problem seems to be that Design Studio fails to select a default build tool for files with the ".cpp" extension.

Changing from "--NO TOOL --" to "Standard S32DS C++ Compiler" in the "Tool Chain Editor" for each file solves the problem.

Although this method may be tolerable when adding new files it is not when importing existing projects with a large number of files.

Is there anyway to globally change this behaviour in DS?

Any tips are appreciated!

Ville

0 Kudos
Reply
4,074 Views
stanish
NXP Employee
NXP Employee

Hello Ville,

Thanks for your contribution on the NXP community!

I've tried it on my side, but I cannot reproduce it.

Where did you put your new file? into "src" source folder?

If you create a new generic folder in your project or if you e.g. copy a folder with source files into your project it may not be considered as a source folder.

The generic folder has this icon: S32DS_Generic_folder.png

The source folder icon has little "C" letter above: S32DS_Source_folder.png

Please make sure your new .cpp file is located in a source folder.

If you need to change generic folder to source one (and vice versa): right click on the folder and select "Resource Configurations" -> "Exclude from Build...". Then uncheck the check box for specific Build configuration that should consider this folder as source one.

You can do the same in Build configurations dialog: click in Project Explorer area -> "Build Configurations Explorer". This dialog is more convenient if you need to select/de-select multiple files/folders into a build config.

If the info above does not help .... Can you please post reproducible step-by-step instructions?

Thanks

Stanislav

4,073 Views
villevallinder
Contributor II

This is what I do to produce the error:

Install SDK using "S32_Power_Win32_v1.0_b151127.exe" on a machine running 64-bit Windows 7.

Restart (just in case).

Create a new project using the "New S32DS Project" wizard, name it "Test".

Select the MPC5748G processor and uncheck all but the first core.

Right-click on "src" folder and select New/Source File.

Name it vv.cpp and select "Default C++ source template".

The file appears in the "src" folder (which indeed has the "c"-icon).

Add "int Dummy = 0;" and "int Invalid = 42" (intentionally omitting the ";") to "vv.cpp".

Add "extern int Dummy;" and "Dummy++;" to appropriate places in "Test_Z4_1.c".

Run Project/Build All.

Result:

A linker error "undefined reference to ´Dummy´" is issued for "Test_Z4_1.c" but no compiler error for the missing semicolon in "vv.cpp".

0 Kudos
Reply