You can't have the linker just link to a dll file.
Either you must link to an import library (or possibly it's called an
export library) that contains stub functions to all exported
symbols in the dll file, or you must manually load the dll, and retrieve
pointers to the exported functions and variables in the dll file.
Also, depending on how the dll was compiled, it might use mangled symbol
names of other type or with other calling convention than your main
project is using.
/Per W
On Mon, 16 Dec 2002, Narayan Annamalai wrote:
> Hi all,
>
> I am trying to execute a c++ code that sends queries to a prolog engine back and forth. I got the following linker error when i tried to compile the code:
>
> C:\DOCUME~1\NARAYA~1.CAM\LOCALS~1\Temp\ccqubaaa.o: In function `_7PlTermvG6PlTermT1':
> //C/PROGRA~1/pl/include/SWI-cpp.h(.text$__as__6PlTermPCc+0x16): undefined reference to `PL_unify_atom_chars'
> //C/PROGRA~1/pl/include/SWI-cpp.h(.text$__7PlTermvi+0x13): undefined reference to `PL_new_term_refs'
> //C/PROGRA~1/pl/include/SWI-cpp.h(.text$__7PlFrame+0xb): undefined reference to `PL_open_foreign_frame'
> //C/PROGRA~1/pl/include/SWI-cpp.h(.text$_$_7PlFrame+0x15): undefined reference to `PL_close_foreign_frame'
> //C/PROGRA~1/pl/include/SWI-cpp.h(.text$__7PlQueryPCcRC7PlTermv+0x20): undefined reference to `PL_predicate'
> ...
> ...
> ...
>
> My code is as follows:
> #include <SWI-Prolog.h>
> #include <SWI-cpp.h>
> #include <string>
>
> #include <iostream.h>
>
>
> void loadit(){
> PlFrame fr;
> PlTermv av(1);
> av[0] = "test.pl";
> PlQuery q("consult", av);
> q.next_solution();
> }
> void start(){
> PlFrame fr;
> PlTermv av(1);
> av[0] = "Narayan";
> PlQuery q("receive", av);
> q.next_solution();
> }
>
> int main( int argc, char *argv[] )
> {
> PlEngine e(argv[0]);
> loadit();
> start();
> cerr << "Prolog initialized" << endl;
>
> return 0;
> }
>
> It throws unreferenced errors to all the prolog terms that I have used in the program.
>
> I have set the compiler options in the following way:
>
> C++ incluce directories: <default>, include directory containing prolog header files
>
> Library files: <default>, library containg prolog dll files.
>
> Could anybody advice me on what I am missing here:
>
> Thanks,
> Narayan.
>
>
> _____________________________________________________________
> Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year.
> http://login.mail.lycos.com/brandPage.shtml?pageId=plus&ref=lmtplus
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:
> With Great Power, Comes Great Responsibility
> Learn to use your power at OSDN's High Performance Computing Channel
> http://hpc.devchannel.org/
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|