0

I have a project in C language and it compiles just fine in visual studio without any problem. But for some reasons I need to compile it in CodeBlocks. I can't find a reason why I get this error when I build the project. This is the full build log :

mingw32-gcc.exe  -g -W -O0 -DWIN32 -D_DEBUG -D_WINDOWS -D_USRDLL -DSERVICE_EXPORTS -DAXIS2_DECLARE_EXPORT    -IC:\Tools\axis2c-bin-1.6.0-win32\include -I. -IC:\Tools\axis2c-bin-1.6.0-win32\include -IC:\Tools\axis2c-bin-1.6.0-win32\include\platforms -IE:\dev\CodeBlocks\MinGW  -c C:\Tools\axis2c-bin-1.6.0-win32\bin\tools\wsdl2c\src_addToDatabase_CodeBlocks\adb_Person.c -o "Debug Win32\adb_Person.o"
mingw32-gcc.exe  -g -W -O0 -DWIN32 -D_DEBUG -D_WINDOWS -D_USRDLL -DSERVICE_EXPORTS -DAXIS2_DECLARE_EXPORT    -IC:\Tools\axis2c-bin-1.6.0-win32\include -I. -IC:\Tools\axis2c-bin-1.6.0-win32\include -IC:\Tools\axis2c-bin-1.6.0-win32\include\platforms -IE:\dev\CodeBlocks\MinGW  -c C:\Tools\axis2c-bin-1.6.0-win32\bin\tools\wsdl2c\src_addToDatabase_CodeBlocks\adb_addTodatabaseMethod.c -o "Debug Win32\adb_addTodatabaseMethod.o"
mingw32-gcc.exe  -g -W -O0 -DWIN32 -D_DEBUG -D_WINDOWS -D_USRDLL -DSERVICE_EXPORTS -DAXIS2_DECLARE_EXPORT    -IC:\Tools\axis2c-bin-1.6.0-win32\include -I. -IC:\Tools\axis2c-bin-1.6.0-win32\include -IC:\Tools\axis2c-bin-1.6.0-win32\include\platforms -IE:\dev\CodeBlocks\MinGW  -c C:\Tools\axis2c-bin-1.6.0-win32\bin\tools\wsdl2c\src_addToDatabase_CodeBlocks\adb_addTodatabaseMethodResponse.c -o "Debug Win32\adb_addTodatabaseMethodResponse.o"
mingw32-gcc.exe  -g -W -O0 -DWIN32 -D_DEBUG -D_WINDOWS -D_USRDLL -DSERVICE_EXPORTS -DAXIS2_DECLARE_EXPORT    -IC:\Tools\axis2c-bin-1.6.0-win32\include -I. -IC:\Tools\axis2c-bin-1.6.0-win32\include -IC:\Tools\axis2c-bin-1.6.0-win32\include\platforms -IE:\dev\CodeBlocks\MinGW  -c C:\Tools\axis2c-bin-1.6.0-win32\bin\tools\wsdl2c\src_addToDatabase_CodeBlocks\axis2_extension_mapper.c -o "Debug Win32\axis2_extension_mapper.o"
mingw32-gcc.exe  -g -W -O0 -DWIN32 -D_DEBUG -D_WINDOWS -D_USRDLL -DSERVICE_EXPORTS -DAXIS2_DECLARE_EXPORT    -IC:\Tools\axis2c-bin-1.6.0-win32\include -I. -IC:\Tools\axis2c-bin-1.6.0-win32\include -IC:\Tools\axis2c-bin-1.6.0-win32\include\platforms -IE:\dev\CodeBlocks\MinGW  -c C:\Tools\axis2c-bin-1.6.0-win32\bin\tools\wsdl2c\src_addToDatabase_CodeBlocks\axis2_stub_AddToDatabaseService.c -o "Debug Win32\axis2_stub_AddToDatabaseService.o"
mingw32-gcc.exe  -g -W -O0 -DWIN32 -D_DEBUG -D_WINDOWS -D_USRDLL -DSERVICE_EXPORTS -DAXIS2_DECLARE_EXPORT    -IC:\Tools\axis2c-bin-1.6.0-win32\include -I. -IC:\Tools\axis2c-bin-1.6.0-win32\include -IC:\Tools\axis2c-bin-1.6.0-win32\include\platforms -IE:\dev\CodeBlocks\MinGW  -c C:\Tools\axis2c-bin-1.6.0-win32\bin\tools\wsdl2c\src_addToDatabase_CodeBlocks\main.c -o "Debug Win32\main.o"
mingw32-gcc.exe  -g -W -O0 -DWIN32 -D_DEBUG -D_WINDOWS -D_USRDLL -DSERVICE_EXPORTS -DAXIS2_DECLARE_EXPORT    -IC:\Tools\axis2c-bin-1.6.0-win32\include -I. -IC:\Tools\axis2c-bin-1.6.0-win32\include -IC:\Tools\axis2c-bin-1.6.0-win32\include\platforms -IE:\dev\CodeBlocks\MinGW  -c C:\Tools\axis2c-bin-1.6.0-win32\bin\tools\wsdl2c\src_addToDatabase_CodeBlocks\adb_Message.c -o "Debug Win32\adb_Message.o"
mingw32-g++.exe -LC:\Tools\axis2c-bin-1.6.0-win32\lib -LC:\Tools\axis2c-bin-1.6.0-win32\lib -LE:\dev\CodeBlocks\MinGW\lib  -o AddToDatabaseServiceClient.exe "Debug Win32\adb_Person.o" "Debug Win32\adb_addTodatabaseMethod.o" "Debug Win32\adb_addTodatabaseMethodResponse.o" "Debug Win32\axis2_extension_mapper.o" "Debug Win32\axis2_stub_AddToDatabaseService.o" "Debug Win32\main.o" "Debug Win32\adb_Message.o"    C:\Tools\axis2c-bin-1.6.0-win32\lib C:\Tools\axis2c-bin-1.6.0-win32\lib\axiom.lib C:\Tools\axis2c-bin-1.6.0-win32\lib\axutil.lib C:\Tools\axis2c-bin-1.6.0-win32\lib\axis2_engine.lib 
e:/dev/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/../../../../mingw32/bin/ld.exe: C:\Tools\axis2c-bin-1.6.0-win32\lib: No such file: Permission denied
collect2: ld returned 1 exit status

Process terminated with status 1 (0 minutes, 8 seconds)
0 errors, 0 warnings

I'm using CodeBlocks 10.05 and GNU GCC compiler(minGW). the project is an axis2c generated C webservice client.

I put -fPIC in Other options tab under the Compiler settings. then I rebuilt the project. as it was mentioned in CodeBlocks-wiki . I tried to run the application but I got that error again.

I have another question that I posted in This link which is related to this issue. I'd appreciate it if anyone help me.

Community
  • 1
  • 1
Sarah Aziziyan
  • 498
  • 9
  • 22

2 Answers2

1

Do you see that the linker's error message says:

C:\Tools\axis2c-bin-1.6.0-win32\lib: No such file

That is because there is no such file as C:\Tools\axis2c-bin-1.6.0-win32\lib. It is a directory, and you cannot "link a directory", just as you cannot "compile a directory".

We can be sure it is a directory because all the libraries that you are linking are in that directory:

C:\Tools\axis2c-bin-1.6.0-win32\lib\axiom.lib 
C:\Tools\axis2c-bin-1.6.0-win32\lib\axutil.lib 
C:\Tools\axis2c-bin-1.6.0-win32\lib\axis2_engine.lib

and also because you have specified (twice) that it is a directory that the linker should search to find libraries:

-LC:\Tools\axis2c-bin-1.6.0-win32\lib -LC:\Tools\axis2c-bin-1.6.0-win32\lib 

You need to either:

  • Replace C:\Tools\axis2c-bin-1.6.0-win32\lib in your Link libraries settings with C:\Tools\axis2c-bin-1.6.0-win32\lib\<name_of_some_missing_library>.lib

or, if there is no missing library (the 3 above are all you need), then:

  • Delete C:\Tools\axis2c-bin-1.6.0-win32\lib from your Link libraries settings

You can also delete -LC:\Tools\axis2c-bin-1.6.0-win32\lib from the Other linker options (if that's how you've specified this linker search path), and/or you can delete C:\Tools\axis2c-bin-1.6.0-win32\lib from Search directories -> Linker (if that's how you've done it). You are specifying all of the axis libraries by absolute pathnames, so there is no need to tell the linker where to look for them.

You may have also have produced this duplicated linker search path by specifying it once in Settings -> Compiler -> Global compiler settings and again in the Linker settings or Search directories -> Linker of your project. If so, remove it from the global compiler settings. Those settings are ones that you want to apply to every project that you build with the compiler: that's the significance of Global.

-fPIC has no relevance whatever and you do not require it to build an .exe

Mike Kinghan
  • 55,740
  • 12
  • 153
  • 182
0

I did what @Mike Kinghan said. plus I searched and found out that the libraries that I'm using are compiled with MSVC++ and cannot be used with MinGW. according to this topic.

  • I created .def files with reimp
  • then I modified each stdcall function in .def files (I changed "_name@ordinal" to "name")
  • then I used dlltool to create .a files.

I linked the .a files to my project. Everything went fine and I could compile my project. but when I try to run it. I get this error.

The procedure entry point axiom_attribute_create could not be located in the dynamic link library

I have got no idea what to do.

Sarah Aziziyan
  • 498
  • 9
  • 22
  • 1
    Hi Sarah. I'm afraid you're not using SO correctly. It seems that my answer solved the linker problem you posted and now you have a new problem, at runtime. But you have posted your new problem as an *answer* to your old question, so nobody can answer it! Post it as a new *question* (if you want to). If you think my answer solved the original problem, then you can [accept it](http://stackoverflow.com/help/accepted-answer). If you don't think so, then don't; but you can't use one SO question to get answers to an open-ended series of your problems. That's not how it works :) – Mike Kinghan Feb 23 '15 at 18:56
  • P.S. If you wish to post the new issue as a new question, you can say it follows up your first question and include a link to your first question (which you can get from the *share* button under the question). – Mike Kinghan Feb 24 '15 at 13:34