• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

using namespaces

Community Beginner ,
Feb 13, 2017 Feb 13, 2017

Copy link to clipboard

Copied

We have implemented a Plug-In (with CS2 so fare) which is implementing an XML-parser on request , a d respective document creation and the saving of the document by customer code (to different nodes).

To transfer the paresed values to the respective functionality we have implemented an namespace parsing_results at a namaspaces.h file inside a #pragma once-scope.

The namespaces.h we include into out ID.h-File.

At the respective classes we've implemented 'using namespace parsig_results'.

With these implementationes we my compile all our project classes separately successfully.

But at Build the linker is claiming, when processing our UIC.fr-file, that he is missing at namespaces.h 'resource' or 'type' at namespace declaration.

We've searched for information concerning additional declarations for namespaces but did not find any.

Can anybody give us a hint, to solve that failure.

Regards

Jochen Seliger

TOPICS
SDK

Views

643

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Feb 13, 2017 Feb 13, 2017

Copy link to clipboard

Copied

In general, don't include C++ headers into .fr sources.

If you need that namespace.h in your .cpp code, include it from there, not in the *ID.h .

You can also use the preprocessor, available in both languages.

https://de.wikipedia.org/wiki/C-Präprozessor

One example would be the SDK's LocaleIndex.h

#ifdef __ODFRC__

/* code for .fr */

#else

/* code for .cpp */

#include "namespace.h"

#endif

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 13, 2017 Feb 13, 2017

Copy link to clipboard

Copied

Hi Dirk,

due to errors while including the namespaces.h into my ID.h or fr.file, I do include it into the two classes requiring to access the variables declared within my parsing_results namespace.

But in thet case I get errors for duplikted declaratio of the veriables.

The only solution ovoiding these errors is the static declaration of the nemespace member variables.

But in thet case I can't let set the values by my XML-Parser.

Yust now I've tested ad dynamically extention of the namespace, explained by IBM, but this again does nort work.

I'll read the information you've posted and wil return.

Regards

Jochen

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 14, 2017 Feb 14, 2017

Copy link to clipboard

Copied

Hi Dirk,

I've now added '#include "namespaces.h"' to the Preprocessor Definitions.

That line is obviousely accepted.

Now, while compiling TriggerResourceDeps.cpp error C4651: '/D=include namespaces.h' specified for precompiled heder but not for current compile is thrown.

Where to set the approprialte command for current compile?

Regards

Jochen

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 14, 2017 Feb 14, 2017

Copy link to clipboard

Copied

Hi Dirk,

I've implmented the line '#include "namespaces.h"' into the LocaleIndex.h and tryed to build m project, but the class, which is using 'parsing-results' does not find it.

At the moment the only solution to let the two classes the mentioned namespace is to include the 'namespaces.h' into both classes.

But than I get the errors concerning duplicated deklaration.

So wht is the right place to include the named header once?

Regards

Jochen

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Feb 14, 2017 Feb 14, 2017

Copy link to clipboard

Copied

Jochen,

in LocaleIndex.h Adobe has used the preprocessor to keep both .fr and .cpp code within the same source, using those #ifdef __ODFRC__ directives. I mentioned that file only as the simplest example that I found in the SDK. Please don't modify it or any other SDK file, just look at it to understand the principles. If you haven't done that yet, restore a copy from backup.

I'm sorry but I can't help you with your other namespace problems (duplicate variable declarations).

Regards,

Dirk

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 15, 2017 Feb 15, 2017

Copy link to clipboard

Copied

LATEST

Hi Dirk,

I've implemented the liner #include "namespaces.h" at a Copy of LocaleIndex.h within the else branche of #ifdef __ODRFC__, because I get errors from Metaprogramming.h in the other case.

At my namespaces.h I've placed some Messagebox and obviousely the file is inculded.

When implementing a CAlert with 'aktOrder="+parsing_results::aktOrder;, I can see the member varibles of my parsing_results, after typing the second colon.

But the compiler is claiming, that pasing_result is not a namespace and aktOrder is undefined.

What is wrong here?

Please help me!!

Regards

Jochen

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines