Book a Demo

Author Topic: C code generation lost .c files  (Read 5073 times)

tonyb

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
C code generation lost .c files
« on: January 24, 2016, 04:39:29 am »
Greetings, does anyone know how to generate both .c and .h files from classes? The feature had been working fine, but suddenly the tool started generating .java files instead. I selected Auto Generate Files, selected the root dir, and specifically chose a .h file name. Now the only files that get generated are .h files, no more .c files.

Is there a way to "reset" this feature?

P.S. I'm only generating a package with one or two files. New to the tool and evaluating it for our department's use.


tonyb

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: C code generation lost .c files
« Reply #1 on: January 24, 2016, 09:35:53 am »
The same thing happened again this afternoon. Here is a little more info. I generated code for a single class many times by right clicking on it and using the Code Engineering... menu item. Worked great in this case, the .c and .h file I was expecting were generated.

This class is nested in a package hierarchy. When I tried generating code by right clicking on the root package (and using the Code Engineering... menu item), the tool generated a single .java file. I've check each package and the class itself, and the Language Setting is still C. So, same as before, I change the file path such that the file name is now .h, but the tool will only generate the .h file and not the .c file.

Regards

Dermot

  • EA Administrator
  • EA User
  • *****
  • Posts: 591
  • Karma: +7/-0
    • View Profile
Re: C code generation lost .c files
« Reply #2 on: January 25, 2016, 11:48:25 am »
With the source code generation you do need  set the default Code Language using the Code generation Toolbar:
http://sparxsystems.com/enterprise_architect_user_guide/12.1/the_user_interface/codetoolbar.html

Also ensure that the Class element has the Language set correctly to c.

When set to C or C++ this should generate to c or cpp plus a .h file.
Once generated use the F12 key to view these.

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: C code generation lost .c files
« Reply #3 on: January 27, 2016, 08:29:30 pm »
Hi Tony,

The language generated from classes and packages is controlled by the Language property.
As Dermot suggests, you can set the "default code language", which sets the default value for the Language property in packages and classes you create.

The default value for the "default code language" setting is Java. So that's probably what's causing your issue.

If you've created a larger number of packages and classes, you can set the Language property for a package tree by right-clicking it in the project browser and selecting Code Engineering -- Reset Options for This Package.

HTH,


/Uffe
My theories are always correct, just apply them to the right reality.

tonyb

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: C code generation lost .c files
« Reply #4 on: January 28, 2016, 04:12:08 am »
Thank you for the comments. I was able to get code generation working well.