Re: Problems linking c++/SWI executable for Windows
Olivier Sallou <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On 10/31/2013 05:31 PM, Jan Wielemaker wrote:
> I've had a little look into this and so far reached the following
> conclusions:
>
> - Using MinGW with gcc 4.7.0, I can simply link to the 32-bit version
> of SWI-Prolog using these commands:
>
> ==
> SWI_PROLOG_HOME=/E/mingw32/swipl
> PATH="$SWI_PROLOG_HOME/bin:/c/mingw/bin:$PATH"
>
> make()
> { gcc -I$SWI_PROLOG_HOME/include -L$SWI_PROLOG_HOME/lib -o hello.exe
> hello.c -lswipl
> }
> ==
>
> Attached you find hello.c
>
> I don't have MinGW gcc for X64 installed. If the 32-bit version works
> and the 64 doesn't, please let me know.
I use only x64 version. I will try with 32-bit version.
>
> - Using MSVC 2009 (Express version), I can _now_ link to both the 32
> and 64-bit versions. This was achieved by following the MinGW FAQ
> for creating libswipl.lib by making MinGW generate a .def file and
> using MSVC lib.exe to create the .lib file from there.
>
> This is now in the GIT repo, so tomorrow's daily build should ship
> with .lib files (if we are lucky).
I have higher version of MSVC but I should be able to test.
>
> Nothing special is needed.
>
> Hope this helps
>
> --- Jan
>
>
>
> On 10/24/2013 11:05 AM, Olivier Sallou wrote:
>>
>> On 10/23/2013 03:49 AM, Kaitain Jones wrote:
>>> Got my SWI-powered app compiling and running on Linux and OSX. Not yet
>>> succeeded on Windows.
>>>
>>> I installed all the MinGW/gcc toolchain stuff today, and everything
>>> appears
>>> to be compiling as on the other two platforms, but it seems to be
>>> falling
>>> at the final linking hurdle. swipl-ld builds the two object files I was
>>> expecting without any apparent problems. But then it calls the final
>>> link
>>> phase to build the exe:
>>>
>>> *g++ -o s2.exe s_int.obj s_helpers.obj -L"c:/program files/swipl/lib"
>>> -lswipl*
>>>
>>> At this point, it spits out a slew of linker errors:
>>>
>>> *s_helpers.obj:s_helpers.cpp:(.text+0x50c): undefined reference to
>>> `PL_new_term_ref'
>>> *
>>> *s_helpers.obj:s_helpers.cpp:(.text+0x52f): undefined reference to
>>> `PL_put_nil'*
>>> etc.
>>>
>>> In short, even though it finds either *libswipl.dll.a *or (?)
>>> *libswipl.lib*in
>>> *c:/program files/swipl/lib* (and complains if I move or rename
>>> them), it
>>> appears not to know what any of the Prolog-specific elements are at
>>> link
>>> time.
>>>
>>> Anyone know what's likely to be going on?
>>>
>>> This is a 64-bit Win7 environment, btw. (And I'm attempting the compile
>>> from inside a MinGW32 window.)
>> I am of no help, but I face exactly the same issue on Windows 8 with
>> MingW too.
>>
>> Olivier
>>>
>>> Running the swipl repl works fine.
>>>
>>> Thanks,
>>>
>>> KJ
>>> -------------- next part --------------
>>> HTML attachment scrubbed and removed
>>> _______________________________________________
>>> SWI-Prolog mailing list
>>> [email protected]
>>> https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog
>>>
>>>
>>
>
--
Olivier Sallou
IRISA / University of Rennes 1
Campus de Beaulieu, 35000 RENNES - FRANCE
Tel: 02.99.84.71.95
gpg key id: 4096R/326D8438 (keyring.debian.org)
Key fingerprint = 5FB4 6F83 D3B9 5204 6335 D26D 78DC 68DB 326D 8438