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

NLopt 2.4.1 won't build on MS Windows / Visual Studio #12

Closed
fred777 opened this issue Feb 18, 2014 · 2 comments
Closed

NLopt 2.4.1 won't build on MS Windows / Visual Studio #12

fred777 opened this issue Feb 18, 2014 · 2 comments

Comments

@fred777
Copy link

fred777 commented Feb 18, 2014

I just want to report my findings on how to compile latest NLopt on MS Windows / Visual Studio (2008).

At first, esch/esch.c and esch/esch.h have to be added to CMakeLists.txt

Then, M_PI has to be included in esch.c somehow - either via

define _USE_MATH_DEFINES

include <math.h>

or simply via

ifndef M_PI

define M_PI 3.14159265358979323846

endif

Finally, MS C compiler does not like "(void) unused;" in esch.c, line 62 - it can be simply commented out to make it work.

@stevengj
Copy link
Owner

(void) unused; is standard C/C++, as I understand it. Can you give more information on this error? (If it is just a warning, it can be safely ignored.)

@fred777
Copy link
Author

fred777 commented Feb 18, 2014

It's a fully fledged error:

1>esch.c
1>..\nlopt-2.4.1\esch\esch.c(63) : error C2143: Syntaxfehler: Es fehlt ';' vor 'const'
1>..\nlopt-2.4.1\esch\esch.c(64) : error C2143: Syntaxfehler: Es fehlt ';' vor 'const'
1>..\nlopt-2.4.1\esch\esch.c(65) : error C2065: 'a': nichtdeklarierter Bezeichner
1>..\nlopt-2.4.1\esch\esch.c(65) : error C2223: Der linke Teil von '->fitness' muss auf eine Struktur/Union zeigen
1>..\nlopt-2.4.1\esch\esch.c(65) : error C2065: 'b': nichtdeklarierter Bezeichner
1>..\nlopt-2.4.1\esch\esch.c(65) : error C2223: Der linke Teil von '->fitness' muss auf eine Struktur/Union zeigen
1>..\nlopt-2.4.1\esch\esch.c(65) : error C2065: 'a': nichtdeklarierter Bezeichner
1>..\nlopt-2.4.1\esch\esch.c(65) : error C2223: Der linke Teil von '->fitness' muss auf eine Struktur/Union zeigen
1>..\nlopt-2.4.1\esch\esch.c(65) : error C2065: 'b': nichtdeklarierter Bezeichner
1>..\nlopt-2.4.1\esch\esch.c(65) : error C2223: Der linke Teil von '->fitness' muss auf eine Struktur/Union zeigen
1>..\nlopt-2.4.1\esch\esch.c(65) : fatal error C1903: Weiterverarbeitung nach vorherigem Fehler nicht möglich; Kompilierung wird abgebrochen.

Visual Studio is non-standard sometimes ;)

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

2 participants