Hey, you're right! I just tried stripping off all the additional includes and lib path references that I added ,restoring the commands to precisely those given in MPG---And now it works. I had added the includes, previously, as a response to compiler and linker complaints about not being able to find certain files. Apparently, the special command prompt shortcut in Visual Studio sets up a lot of environment variables, or something.
I guess the bottom line is to be sure you are compiling with the right version of the compiler, and everything should go smoothly. Thanks again, Christian. -Dan- From: Christian Schulte [mailto:[email protected]] Sent: Wednesday, June 16, 2010 12:06 PM To: Dan Scott; [email protected] Subject: RE: [gecode-users] Linking Error InvolvingGecodeSupport-3-3-1-r-x86.lib Actually, given the command line x64 prompt, it should work as described in MPG. I for one use x64 and MSVC professional 2008 all the time on my office machine and there it does everything with the switches as described in MPG. But it might be that Windows XP 64 is just a very strange beast ;-) Christian -- Christian Schulte, web.ict.kth.se/~cschulte/ From: Dan Scott [mailto:[email protected]] Sent: Wednesday, June 16, 2010 8:54 PM To: [email protected]; [email protected] Subject: RE: [gecode-users] Linking Error InvolvingGecodeSupport-3-3-1-r-x86.lib For the sake of anyone else who runs into this same problem, I have made the necessary changes and successfully compiled, linked, and run the program. Here is what I did. 1. Went to: Start -> All Programs -> Microsoft Visual Studio 2008 -> Visual Studio Tools. Within that menu, several command prompt shortcuts were available, including "Visual Studio 2008 x64 Win64 Command Prompt." I ran that one. 2. Using the (just opened) command prompt, I switched to the directory containing send-more-money.cpp, then ran the same compile command as before: cl /DNDEBUG /EHsc /MD /Ox /wd4355 -I"%GECODEDIR%\include" -I"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include" -I"C:\Program Files\Microsoft SDKs\Windows\v6.1\Include" -c -Fosend-more-money.obj -Tpsend-more-money.cpp Note that this looks a little different than the version in MPG because of the extra "includes" that I specified. I think I could have avoided adding those to the command if I had chosen to set up an appropriate environment variable for includes, but I haven't tried that. 3. After the compile command returned successfully (and the send-more-money.obj file appeared in the directory with send-more-money.cpp) I ran the link command, which now looked like this: cl /DNDEBUG /EHsc /MD /Ox /wd4355 -I"%GECODEDIR%\include" -Fesend-more-money.exe send-more-money.obj /link /LIBPATH:"%GECODEDIR%\lib" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\amd64" Note that this is different than what I did before. I am trying to create a 64-bit executable, so I needed to try to link to 64-bit libraries which are in :"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib\amd64" The linker ran successfully, created the exe, which also ran successfully. I expect that I could also have set this all up in the Visual Studio IDE and not used the command line at all, but that's for another day... -Dan- From: [email protected] [mailto:[email protected]] On Behalf Of Dan Scott Sent: Wednesday, June 16, 2010 10:03 AM To: [email protected]; [email protected] Subject: Re: [gecode-users] Linking Error InvolvingGecodeSupport-3-3-1-r-x86.lib Thanks Christian. I thought it must be something like that. I do have the commercial version of Visual Studio, so I will try to enable the 64-bit compiler. -Dan- From: Christian Schulte [mailto:[email protected]] Sent: Wednesday, June 16, 2010 9:54 AM To: Dan Scott; [email protected] Subject: RE: [gecode-users] Linking Error Involving GecodeSupport-3-3-1-r-x86.lib Hi, As the MSVC compiler tells you, you are using a 32 bit compiler (x86 in Microsoft speak) to link against a 64 bit library (x64 in Microsoft speak). It does not matter what your operating system is but what compiler you use when you decide which version of Gecode to install (x64 or x86). As Gecode uses auto linking, the x86 compiler you are using tries to find the x86 library which does not exist on your system. You have two options now: 1. Install Gecode for x86 and keep your compiler for x86. 2. Enable the x64 compiler and keep Gecode for x64 . Step 2. might be tricky if you have the Visual Studio Express Edition only as it is only x86. If you have a commercial version you can enable x64 (but I am not so sure how to do it in MSVC's IDE). Hope that helps Christian -- Christian Schulte, web.ict.kth.se/~cschulte/ From: [email protected] [mailto:[email protected]] On Behalf Of Dan Scott Sent: Wednesday, June 16, 2010 6:45 PM To: [email protected] Subject: [gecode-users] Linking Error Involving GecodeSupport-3-3-1-r-x86.lib Hi, I am a (very) new Gecode user. I am trying to compile and run the send-more-money.cpp example following the direction in section 2.3.1 of the "Modeling and Programming with Gecode" guide. I am using Gecode 3.3.1 that I installed from Gecode-3.3.1-x64.msi, and I am running under Windows XP Professional x64 Edition, using Visual Studio 2008. When I compiled send-more-money.cpp I had some minor issues with specifying the correct include directories, but I dealt with that okay, and successfully created send-more-money.obj. But, I cannot seem to get the linking to work, as it complains that it is unable to open GecodeSupport-3-3-1-r-x86.lib That file does not exist on my system. Instead, I have GecodeSupport-3-3-1-r-x64.lib, which makes sense. But why isn't it trying to link against *this* file? How can I correct this? Do I need to be changing some commands to make it aware of the fact that this is a 64-bit system, or something? The command line compiling and linking text is reproduced below (sorry about the lousy line breaks...) Thanks for any assistance, -Dan- Compiling (This seemed to work okay, but I thought it might possibly be relevant): --------------- D:\Installs\Gecode>cl /DNDEBUG /EHsc /MD /Ox /wd4355 -I"%GECODEDIR%\include" -I" C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include" -I"C:\Program Fil es\Microsoft SDKs\Windows\v6.1\Include" -c -Fosend-more-money.obj -Tpsend-more-m oney.cpp Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. send-more-money.cpp Linking (Here is where the error occurred): ----------- D:\Installs\Gecode>cl /DNDEBUG /EHsc /MD /Ox /wd4355 -I"%GECODEDIR%\include" -Fe send-more-money.exe send-more-money.obj /link /LIBPATH:"%GECODEDIR%\lib" /LIBPAT H:"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib" Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. Microsoft (R) Incremental Linker Version 9.00.30729.01 Copyright (C) Microsoft Corporation. All rights reserved. /out:send-more-money.exe "/LIBPATH:C:\Program Files\Gecode\\lib" "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\lib" send-more-money.obj LINK : fatal error LNK1104: cannot open file 'GecodeSupport-3-3-1-r-x86.lib'
_______________________________________________ Gecode users mailing list [email protected] https://www.gecode.org/mailman/listinfo/gecode-users
