Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Console macros cause compilation errors when used in a gazebo sub-namespace #2896

Closed
stefanbuettner opened this issue Dec 1, 2020 · 2 comments
Labels
bug Something isn't working common

Comments

@stefanbuettner
Copy link
Contributor

stefanbuettner commented Dec 1, 2020

Hey there,

This code does not work

namespace foo::gazebo
{

class bar
{
public:
    void doSomething() {
        gzmsg << "doSomething" << std::endl;
    }
};

}  // foo::gazebo

because gzmsg resolves to (gazebo::common::Console::msg()) which
resolves in this error:

error: ‘foo::gazebo::common’ has not been declared
     #define gzmsg (gazebo::common::Console::msg())

Cheers,
Stefan

stefanbuettner pushed a commit to stefanbuettner/gazebo that referenced this issue Dec 1, 2020
@chapulina chapulina added bug Something isn't working common labels Dec 1, 2020
scpeters pushed a commit that referenced this issue Dec 9, 2020
* Add regression test for #2896
* Fix namespace usage in console macros

This code did not work
```cpp
namespace foo::gazebo
{

class bar
{
public:
    void doSomething() {
        gzmsg << "doSomething" << std::endl;
    }
};

}  // foo::gazebo
```

because gzmsg resolves to (gazebo::common::Console::msg()).
It results in this error:
```
error: ‘foo::gazebo::common’ has not been declared
     #define gzmsg (gazebo::common::Console::msg())
```

Co-authored-by: Stefan Büttner <stefan.buettner@agile-robots.com>
@stefanbuettner
Copy link
Contributor Author

#2892 was merged already. Can this one be closed?

@j-rivero
Copy link
Contributor

#2892 was merged already. Can this one be closed?

Yes, thanks Stefan!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working common
Projects
None yet
Development

No branches or pull requests

3 participants