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

Using trajopt_sqp on Windows fails #978

Open
Astraaaaaaa opened this issue Jan 11, 2024 · 2 comments
Open

Using trajopt_sqp on Windows fails #978

Astraaaaaaa opened this issue Jan 11, 2024 · 2 comments

Comments

@Astraaaaaaa
Copy link

Astraaaaaaa commented Jan 11, 2024

At file: trajopt_sqp\types.h

enum class CostPenaltyType
{
  SQUARED,
  ABSOLUTE, // conflict with macro defined in #include <wingdi.h>
  HINGE
};

// ...

double best_exact_merit{ std::numeric_limits<double>::max() };  // conflict with macro defined in minwindef.h

when I use the trajopt_sqp package would encounter with: error C2143: syntax error : missing '}' before 'constant'

how do you feel about adding those lines before CostPenaltyType?

#if (_WIN32 || _WIN64)
#undef ABSOLUTE
#undef max(a,b)
#endif
@Levi-Armstrong
Copy link
Contributor

@johnwason Thoughts?

@johnwason
Copy link
Contributor

@Astraaaaaaa can you place the trajopt_sqp code in a separate C++ utility file (compilation unit) that doesn't include Windows.h, and then call that utility file from your Windows code? Dealing with this type of issue is a rabbit hole that should be avoidable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants