Hi
I'm building a webservice in axis2c and wanna test it with a client.
I build the skeleton code for the client using the wsdl2c tool in axis.
Now, when I build the solution in Dev-C++, I get a lot of linker errors like the one mentioned in the title:

In function main:
[Linker error] undefined reference to '_imp__axutil_env_create_all'
In function axis2_stub_create_SearchDocs:
[Linker error] undefined reference to '_imp__axutil_error_set_error_number'
[Linker error] undefined reference to '_imp__axutil_error_set_status_code'
etc......

I've been doing a lot of googling and it seems I need some libraries, but can't figure out which ones.
In Dev-C++ I have added all the .lib files from axis2c->lib.
And I have included all the files from the axis2c->include library to the project.
Any help would be appreciated.

Recommended Answers

All 6 Replies

Did you tell the linker
- where to find the axutil library
- to actually use the axutil library.

The #include in your source code just tells the compiler that something exists (like say cout). But you also need a library for the actual implementation, and that's where the linker comes in.

Standard things like the library containing cout are automatically linked for you, so you don't tend to notice what is going on.

Did you tell the linker
- where to find the axutil library
- to actually use the axutil library.

I've told the linker to use axutil.lib in the axis2c\lib together with all the other libs in that directory.

Are these libraries built for dev-c++ (or MinGW).

You can't take take libraries originally aimed at say Visual Studio and use them "as is" with your compiler.
Options
- there is a library conversion tool somewhere to alter the format of libraries
- ask whoever gave you the libraries to sent MinGW/Dev-C++ compatible ones
- get the axutil source code and build the libraries yourself.


Can you post the complete compile and link log as well.

I've attached the complete logfile here.
I've tried to build in Visual Studio also, but that also gives linker errors.

Well this lot just seems wrong to me

C:/axis2c-bin-1.6.0-win32/lib/axiom.lib 
C:/axis2c-bin-1.6.0-win32/lib/axis2_engine.lib 
C:/axis2c-bin-1.6.0-win32/lib/axutil.lib 
C:/axis2c-bin-1.6.0-win32/lib/axis2_http_receiver.lib 
C:/axis2c-bin-1.6.0-win32/lib/axis2_http_sender.lib 
C:/axis2c-bin-1.6.0-win32/lib/axis2_parser.lib 
C:/axis2c-bin-1.6.0-win32/lib/axis2_tcp_receiver.lib 
C:/axis2c-bin-1.6.0-win32/lib/axis2_tcp_sender.lib 
C:/axis2c-bin-1.6.0-win32/lib/axis2_xpath.lib 
-axutil 
-axiom 
-axis2_engine 
-axis2_parser 
-axis2_http_sender 
-axis2_http_receiver 
-axis2_tcp_receiver 
-axis2_tcp_sender 
-axis2_xpath

All the green options would appear to be linking the entire library, whether you need it or not.

The usual syntax (on a Linux/Unix machine at least) would be to say something like -laxutil But for this, perhaps you should state -laxiom.lib That's a lower-case 'L' at the start BTW.
You've already set the path with a -L option, so there is no need to state the full path to each library again.

For sure, the red options are just plain wrong. The linker isn't going to do anything with them.

Hi

Problem solved.
As stated in an earlier reply from Salem, the libraries used were VC++ compiled and therefor could not be used with MinGW/Dev-C++.
I solved the problem by using a tool to create definition files from the existing dll's.
I then edited the stdcall functions in the definition files. All the stdcall functions in the file were in the form "_name@ordinal". I simply changed it to be just "name".
This would have worked also:
name = _name@ordinal
I then used dlltool to create .a files from the dll's and the definition files, .def.
After this, the linking went OK.

commented: Nice job, and thanks for the summary :) +19
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.