Using gnss-microtronics lib inside of own lib

Hello community,

I’ve imported the gnss-microtronics lib inside myOwn lib to use the TGNSS_GGA structure and do something like this:

#define DEBUG (1)
new aGPS[TGNSS_GGA];

GNSS_GetGGA(aGPS);

#if DEBUG >= 1
printf("LAT=%d LONG=%d POSFIX=%d SAT=%d AVAIL=%d\r\n", 
aGPS.Latitude, aGPS.Longitude,  aGPS.PosFixInd, aGPS.SatUsed, aGPS.Available);
#endif

The Lib itself has no errors and I can publish it.
But if I import myOwn lib to my project, I got the following error:

Can someone please tell me what is wrong here?

PS:
I which case I have to enter a imported Lib under .exports to the following list, like its done with the microino lib?

// dependencies including all sub-dependencies (e.g. resolve nesting)
  imports: [
    "~microino.4"
  ],

Best regards,
Marcel

Hello @mklueh,

as you already said, I think this issue is related to your current “.export” configuration for the library.
So I will try to explain the different parts of the library “.export” json file.

Navigate to your “.export” configuration of your library, but keep in mind this setting is only available to CLibs.

image

  1. The “files” section states all the files that you want to export to the users of your library. This means the library code and functions of your library that you want to provide to your users. You can also export help files here, to provide documentation for the library.
// list of files to export
files:{
	"": {
		// .help files only - .helpinc will be resolved automatically!
		help:[ "/dlo/lib/_.help" ],
		// any .inc files
		dlo: [
			"/dlo/lib/_.inc",
		 ]
	}
}
  1. The “imports” section, list all the libraries that your specific library depends on. This means if you use for example the “gnss-microtronics” library in your library, you have to list it in this section. This will ensure that after publishing your library, the “gnss” functions are still available for your library. I suspect this might be the reason why you are getting these errors. An example configuration might look like this:
// dependencies including all sub-dependencies (e.g. resolve nesting)
imports: [
	"~stdlib.3",
	"~microino.4",
	"gnss-microtronics.1",
],
  1. In the “shares” section you can specify all the users that can use your library after publishing it. A “*” means all studio users can import the library and use it.
// limit import to certain dev-accounts (space separated, ""=="*"))
// refers to importing project's *owner*
// shares of head version apply to ALL older versions!
shares:"*"
  1. The “changes” section refers to the patch notes of your library.
// version notes
changes:{
	"1":[
		"ADD added additional features",
		"^-- patch",
		"initial version"
	]
},

Keep in mind, changes to the “.export” file requires a new patch or release of your library, depending on your changes:

Kind regards,
Stefan

Hi Stefan,

thank you very much for explanation.

Unfortunately there are two things i don´t understand yet:

  1. I miss the TGNSS_GGA macro in my Lib in which I imported the gnss-microtronics. In fact, this macro seems to exist because it is documented. And when I create it on myself, a warning appears that it is already there.
    Please look at the next three screenshots:



  2. I imported the gnss-microtronics lib in myOwn Lib and listed it under imports but I still don’t have the desired result, because there is a additional warning and an error under CLIBIMPORT. You can see it in the following screnshot:

Can you please give me some help on the two topics?

Kind regards,
Marcel

UPDATE:
If I also import the gnss-microtronics lib in the main project, it works.
If so, why do I have to list the gnss-microtronics under exports?

Best regards,
Marcel

Hi @mklueh,

I will try to clarify the two issues that you have.

  1. You imported the gnss-microtronics library in your own library, this means the TGNSS_ macros that are described in the studio help should be available to you, even if the autocompletion does not show this specific macro. I have also noticed that sometimes, the autocompletion does not show everything that is available.
    Therefore, please verify if you can still use the TGNSS_GGA macro, for example like this:
    new aTest[TGNSS_GGA];

  2. As you already said in your updated answer the reason for this error is that the gnss-microtronics library is not imported in your main project. The rapidM2M Studio also shows an error in this case:


    The reason why you have to declare the library (e.g. gnss-mircotronics) in the imports section (.export file) of your own library is because the studio has to know which libraries (e.g. gnss-mircotronics) are required by other libraries (e.g. your library), so it can notify the user to import the necessary libraries (e.g. gnss-mircotronics) in the main project.
    Due to this behaviour the dependencies of libraries currently have to be manually imported in your main project.

Kind regards,
Stefan