Gecode / gecode

Generic Constraint Development Environment
https://www.gecode.org
Other
279 stars 76 forks source link

C2244 Visual Studio error #10

Closed ageromin closed 5 years ago

ageromin commented 6 years ago

Hello,

I want to use GeCode for a research purpose and I don't succeed to handle it.

As operating system for GeCode libraries I'm using Microsoft Visual Studio 2017 (15.7.1) under Windows 10 exploitation system.

GeCode libraries linking Step 1 : I installed it to C:\Program Files\Gecode Step 2 : Set up the include directories: Right click on the project –> Properties Open the Configuration Properties –> C/C++ –> General Tab Set the option Additional Include Directories to the value “C:\Program Files\Gecode\include” Step 3 : Set up the library directories: Right click on the project –> Properties Open the Configuration Properties –> Linker –> General Tab Set the option Additional Library Directories to the value “C:\Program Files\Gecode\lib” Step 4 : Right click on the project –> Properties Open the Configuration Properties –> C/C++ –> Precompiled Headers Tab Set the option Create/Use Precompiled Header to the value Not Using Precompiled Headers

When I try to run a pre-defined exemples of programs that are already developped in the GeCode exemple folder (like "money" or "all-intervalle"), we meet each time the same following error C2244:

« 1>c:\program files\gecode\include\gecode\kernel\branch\merit.hpp(193): error C2244: 'Gecode::MeritFunction::MeritFunction' : Can not match function definition with an existing declaration »

Do you know how to fix my problem ? Or do you have advices ?

chschulte commented 6 years ago

I use Gecode every day on the very same platform.

But you did not tell us which Gecode version you use.

Did you first try to use MSVC from the commandline as described in Modeling and Programming with Gecode.

Christian

-- Christian Schulte, https://chschulte.github.io/ Professor of Computer Science, KTH, cschulte@kth.semailto:cschulte@kth.se Expert Researcher, RISE SICS, christian.schulte@ri.semailto:christian.schulte@ri.se

From: Anthony notifications@github.com Sent: Wednesday, June 27, 2018 09:29 To: Gecode/gecode gecode@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [Gecode/gecode] C2244 Visual Studio error (#10)

Hello,

I want to use GeCode for a research purpose and I don't succeed to handle it.

As operating system for GeCode libraries I'm using Microsoft Visual Studio 2017 (15.7.1) under Windows 10 exploitation system.

GeCode libraries linking Step 1 : I installed it to C:\Program Files\Gecode Step 2 : Set up the include directories: Right click on the project –> Properties Open the Configuration Properties –> C/C++ –> General Tab Set the option Additional Include Directories to the value “C:\Program Files\Gecode\include” Step 3 : Set up the library directories: Right click on the project –> Properties Open the Configuration Properties –> Linker –> General Tab Set the option Additional Library Directories to the value “C:\Program Files\Gecode\lib” Step 4 : Right click on the project –> Properties Open the Configuration Properties –> C/C++ –> Precompiled Headers Tab Set the option Create/Use Precompiled Header to the value Not Using Precompiled Headers

When I try to run a pre-defined exemples of programs that are already developped in the GeCode exemple folder (like "money" or "all-intervalle"), we meet each time the same following error C2244:

« 1>c:\program files\gecode\include\gecode\kernel\branch\merit.hpp(193): error C2244: 'Gecode::MeritFunction::MeritFunction' : Can not match function definition with an existing declaration »

Do you know how to fix my problem ? Or do you have advices ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/Gecode/gecode/issues/10, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ANfhhTMCWtSSKfYbSpta3khUB14uyUahks5uAzQ8gaJpZM4U5MLN.

ageromin commented 6 years ago

I use Gecode 6.0.1 version.

When I try to use MSVC from the commandline I also face an error : `C:\Program Files (x86)\Microsoft Visual Studio\2017\Community>cl /DNDEBUG /EHsc /MD /0x /wd4355 -I"C:\Program Files\Gecode\include" -c -Fomoney.obj -Tpmoney.cpp Compilateur d'optimisation Microsoft (R) C/C++ version 19.14.26428.1 pour x86 Copyright (C) Microsoft Corporation. Tous droits réservés.

cl : Ligne de commande warning D9002 : option '/0x' inconnue ignorée money.cpp c1xx: fatal error C1083: Impossible d'ouvrir le fichier source : 'money.cpp' : No such file or directory `

Anthony

chschulte commented 6 years ago

I think you are not using the Visual Studio Command Line prompt. And it is Ox not 0x. Christian

-- Christian Schulte, https://chschulte.github.io/ Professor of Computer Science, KTH, cschulte@kth.semailto:cschulte@kth.se Expert Researcher, RISE SICS, christian.schulte@ri.semailto:christian.schulte@ri.se

From: Anthony notifications@github.com Sent: Wednesday, June 27, 2018 09:59 To: Gecode/gecode gecode@noreply.github.com Cc: Christian Schulte cschulte@kth.se; Comment comment@noreply.github.com Subject: Re: [Gecode/gecode] C2244 Visual Studio error (#10)

I use Gecode 6.0.1 version.

When I try to use MSVC from the commandline I also face an error : `C:\Program Files (x86)\Microsoft Visual Studio\2017\Community>cl /DNDEBUG /EHsc /MD /0x /wd4355 -I"C:\Program Files\Gecode\include" -c -Fomoney.obj -Tpmoney.cpp Compilateur d'optimisation Microsoft (R) C/C++ version 19.14.26428.1 pour x86 Copyright (C) Microsoft Corporation. Tous droits réservés.

cl : Ligne de commande warning D9002 : option '/0x' inconnue ignorée money.cpp c1xx: fatal error C1083: Impossible d'ouvrir le fichier source : 'money.cpp' : No such file or directory `

Anthony

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/Gecode/gecode/issues/10#issuecomment-400579215, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ANfhhaVlWFMF7UTlcwG_q20g5AF5T6gEks5uAztYgaJpZM4U5MLN.

ageromin commented 6 years ago

Thank you for helping me but I still meet a problem.

I replaced the "0" whith the "O" as requested.

I used the Visual Studio 2017 Developer Command Prompt v15.7.1 at the directory :"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" opended with visual.

( I am not sure that this is the right Command, there are also two other command when I search "command visual studio" on windows->Programs:

If this is the right command line, the same error as before is appearing

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE>cl /DNDEBUG /EHsc /MD /Ox /wd4355 -I"C:\Program Files\Gecode\include" -c -Fomoney.obj -Tpmoney.cpp Compilateur d'optimisation Microsoft (R) C/C++ version 19.14.26428.1 pour x86 Copyright (C) Microsoft Corporation. Tous droits réservés.

money.cpp c1xx: fatal error C1083: Impossible d'ouvrir le fichier source : 'money.cpp' : No such file or directory

The file directory of "money.cpp" is: C:\Program Files (x86)\Gecode\examples\money.cpp

chschulte commented 6 years ago

Really, I can’t help you here. This is not a Gecode error. Of course this does not work as the file is in the wrong directory. Please learn how to compile a program first. Christian

-- Christian Schulte, https://chschulte.github.io/ Professor of Computer Science, KTH, cschulte@kth.semailto:cschulte@kth.se Expert Researcher, RISE SICS, christian.schulte@ri.semailto:christian.schulte@ri.se

From: Anthony notifications@github.com Sent: Wednesday, June 27, 2018 13:46 To: Gecode/gecode gecode@noreply.github.com Cc: Christian Schulte cschulte@kth.se; Comment comment@noreply.github.com Subject: Re: [Gecode/gecode] C2244 Visual Studio error (#10)

Thank you for helping me but I still meet a problem.

I replaced the "0" whith the "O" as requested.

I used the Visual Studio 2017 Developer Command Prompt v15.7.1 at the directory :"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" opended with visual.

( I am not sure that this is the right Command, there are also two other command when I search "command visual studio" on windows->Programs:

If this is the right command line, the same error as before is appearing

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE>cl /DNDEBUG /EHsc /MD /Ox /wd4355 -I"C:\Program Files\Gecode\include" -c -Fomoney.obj -Tpmoney.cpp Compilateur d'optimisation Microsoft (R) C/C++ version 19.14.26428.1 pour x86 Copyright (C) Microsoft Corporation. Tous droits réservés.

money.cpp c1xx: fatal error C1083: Impossible d'ouvrir le fichier source : 'money.cpp' : No such file or directory

The file directory of "money.cpp" is: C:\Program Files (x86)\Gecode\examples\money.cpp

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/Gecode/gecode/issues/10#issuecomment-400643298, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ANfhhZMqdMUysn6_DrvuaQ3WBVhbQwD5ks5uA3BbgaJpZM4U5MLN.

Haukinger commented 6 years ago

Same here, I can compile on the command line, but visual studio complains about meritfunction. Did you solve the problem by now?

EDIT: solved

The problem's that visual studio defaults to /permissive- and that causes the error. In the project properties under c/c++ set conformity to no and you're good to go.

ageromin commented 6 years ago

I succeded to compile on the command line also but I didn't find any working set up on Visual Studio for the moment.

jonatan1024 commented 5 years ago

I've managed to fix this bug by removing the flag /permissive- from the command line. It can be done by setting Configuration Properties -> C/C++ -> Language -> Conformance mode to No.

chschulte commented 5 years ago

Okay, I think I'll have to have a look at this.

chschulte commented 5 years ago

Fixed in develop. The problem is that the default configuration for the command line compiler is -permissive and for the IDE is -permissive- which in fact is too strong for most practical purposes...