Bug #1175

OpenCV preprocessor symbol collides with ParticipantConfig::ErrorStrategy enum values

Added by A. Swadzba over 11 years ago. Updated about 11 years ago.

Status:ResolvedStart date:09/28/2012
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:C++
Target version:rsb-0.9

Description

I need to but the rsb-Header first to get my program compiled. Otherwise I get the following error (files are appended):

In file included from /vol/flexirob/releases/trunk/include/rsb/Factory.h:41,
                 from /homes/aswadzba/Projects/ECHORD/flexirob/modules/Perception/StaticDynamic-SceneEstimation/helloworld.cpp:11:
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:210: error: expected identifier before ‘goto’
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:210: error: expected ‘}’ before ‘goto’
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:210: error: expected unqualified-id before ‘goto’
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:217: error: expected unqualified-id before ‘)’ token
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:218: error: declaration of ‘~rsb::ParticipantConfig’ as non-member
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:225: error: non-member function ‘rsb::QualityOfServiceSpec rsb::getQualityOfServiceSpec()’ cannot have cv-qualifier
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:246: error: ‘ErrorStrategy’ does not name a type
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:251: error: ISO C++ forbids declaration of ‘ErrorStrategy’ with no type
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:251: error: expected ‘,’ or ‘...’ before ‘&’ token
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:262: error: ‘Transport’ was not declared in this scope
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:262: error: template argument 1 is invalid
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:262: error: template argument 2 is invalid
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:262: error: template argument 3 is invalid
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:262: error: invalid type in declaration before ‘;’ token
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:262: error: non-member function ‘int rsb::getTransports(bool)’ cannot have cv-qualifier
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:272: error: ‘Transport’ does not name a type
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:282: error: expected constructor, destructor, or type conversion before ‘&’ token
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:289: error: ISO C++ forbids declaration of ‘Transport’ with no type
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:289: error: expected ‘,’ or ‘...’ before ‘&’ token
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:297: error: ISO C++ forbids declaration of ‘Transport’ with no type
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:297: error: expected ‘,’ or ‘...’ before ‘&’ token
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:304: error: ‘Transport’ was not declared in this scope
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:304: error: template argument 1 is invalid
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:304: error: template argument 2 is invalid
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:304: error: template argument 3 is invalid
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:306: error: expected initializer before ‘&’ token
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:308: error: expected constructor, destructor, or type conversion before ‘&’ token
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:311: error: expected initializer before ‘&’ token
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:318: error: non-member function ‘rsc::runtime::Properties rsb::getOptions()’ cannot have cv-qualifier
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:360: error: cannot allocate an object of abstract type ‘rsb::ParticipantConfig’
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:62: note:   because the following virtual functions are pure within ‘rsb::ParticipantConfig’:
/vol/flexirob/releases/trunk/include/rsc/config/OptionHandler.h:54: note:     virtual void rsc::config::OptionHandler::handleOption(const std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, const std::string&)
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:359: error: invalid abstract return type for function ‘rsb::ParticipantConfig rsb::fromFile(const boost::filesystem::path&, const rsb::ParticipantConfig&)’
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:62: note:   since type ‘rsb::ParticipantConfig’ has pure virtual functions
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:382: error: cannot allocate an object of abstract type ‘rsb::ParticipantConfig’
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:62: note:   since type ‘rsb::ParticipantConfig’ has pure virtual functions
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:381: error: invalid abstract return type for function ‘rsb::ParticipantConfig rsb::fromEnvironment(const rsb::ParticipantConfig&)’
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:62: note:   since type ‘rsb::ParticipantConfig’ has pure virtual functions
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:401: error: cannot allocate an object of abstract type ‘rsb::ParticipantConfig’
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:62: note:   since type ‘rsb::ParticipantConfig’ has pure virtual functions
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:400: error: invalid abstract return type for function ‘rsb::ParticipantConfig rsb::fromConfiguration(const rsb::ParticipantConfig&)’
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:62: note:   since type ‘rsb::ParticipantConfig’ has pure virtual functions
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:402: error: expected unqualified-id before ‘private’
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:406: error: ‘ErrorStrategy’ does not name a type
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:407: error: ‘Transport’ was not declared in this scope
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:407: error: template argument 2 is invalid
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:407: error: template argument 4 is invalid
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:407: error: invalid type in declaration before ‘;’ token
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:408: error: ‘EventProcessingStrategy’ does not name a type
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:409: error: ‘EventProcessingStrategy’ does not name a type
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:415: error: non-member function ‘void rsb::printContents(std::ostream&)’ cannot have cv-qualifier
/vol/flexirob/releases/trunk/include/rsb/ParticipantConfig.h:418: error: expected declaration before ‘}’ token
make[2]: *** [CMakeFiles/helloworld.dir/helloworld.cpp.o] Error 1
make[1]: *** [CMakeFiles/helloworld.dir/all] Error 2
make: *** [all] Error 2

CMakeLists.txt Magnifier (1 KB) A. Swadzba, 09/28/2012 04:25 PM

helloworld.cpp Magnifier (1.8 KB) A. Swadzba, 09/28/2012 04:25 PM


Related issues

Duplicated by Robotics Service Bus - Support #1298: RSB and openCV: compile success depends on order of includes Rejected 12/13/2012

Associated revisions

Revision 5dc28f3d
Added by J. Wienke about 11 years ago

Rename error strategy enum values to prevent clashes with precompiler symbols from e.g. OpenCV

refs #1175

Revision 6d74303e
Added by J. Wienke about 11 years ago

Avoid conflicts with OpenCV by reanming the ErrorStrategy enum values.

Merge branch 'bug-1175'

fixes #1175

Revision 64d47732
Added by J. Moringen about 11 years ago

Fixed error strategy enum elements in cpp/config.cpp

refs #1175

  • cpp/config.cpp: fixed error strategy enum element names {LOG,PRINT,EXIT} -> ERROR_STRATEGY_{LOG,PRINT,EXIT}

History

#1 Updated by J. Wienke over 11 years ago

  • Description updated (diff)

Which version of RSB is affected?

#2 Updated by J. Wienke over 11 years ago

In any case, I suspect that one of the symbols in the following enum is affected by a macro or define in opencv:

    enum ErrorStrategy {
        /**
         * Logs a message using the logging mechanism.
         */
        LOG,
        /**
         * Uses stderr for printing a message.
         */
        PRINT,
        /**
         * exits the program.
         */
        EXIT
    };

So maybe it would be a good idea to change the names accordingly and prefix all of them with ERROR_STRATEGY_ in order to prevent these clashes in the future. Even though this results in an API break, this enum is probably used very rarely.

#3 Updated by J. Wienke over 11 years ago

  • Category set to C++

#4 Updated by A. Swadzba over 11 years ago

rsb-0.7.0

#5 Updated by J. Wienke over 11 years ago

  • Subject changed from Strange dependencies between opencv and rsb headers to OpenCV preprocessor symbol collides with ParticipantConfig::ErrorStrategy enum values
  • Target version set to rsb-0.9

Ok, I don't think there is a chance that we can fix this in 0.7 as this would result in an API break within a maintained release. So I assign this to 0.8.

#6 Updated by J. Wienke about 11 years ago

  • Status changed from New to In Progress

#7 Updated by J. Wienke about 11 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

Applied in changeset rsb-cpp|commit:6d74303e6128b5f9e940b370a97594830ad4acee.

#8 Updated by J. Moringen about 11 years ago

This change broke the integration test (fix committed). Why didn't we catch this? I mean, what's the point of the whole CI thing, if it doesn't catch this kind of errors?

#9 Updated by J. Wienke about 11 years ago

No idea why I received no email.

Also available in: Atom PDF