4

I am getting a the following error in code blocks using gnu gcc compiler, when I try to compile the code I get these errors:

c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find-                                          lstrmbase
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find -lz
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 21 seconds)
2 errors, 0 warnings (0 minutes, 21 seconds)
Lehue
  • 425
  • 8
  • 26
user3190183
  • 41
  • 1
  • 1
  • 2

2 Answers2

5
  1. First, make sure you have strmbase.lib (or libstrmbase.lib) and z.lib (libz.lib) in your mingw lib directory (it should be "c:/mingw/gcc/mingw32/4.6.2/" in your case).

  2. Second, if they do exist, try to add "c:/mingw/gcc/mingw32/4.6.2/" to your library search path.

    There may be GUI option like "LIBRARY PATH" for that, although I don't know about code blocks.

    Alternatively, you can pass an option to gcc "-L c:/mingw/gcc/mingw32/4.6.2/" (It must be before "-l..." flags)

EDIT:

  1. z.lib is zlib. You can build it using your gcc or download prebuilt binary from MinGW web-site (should be inside MinGW -> Extension).

  2. strmbase.lib is from DirectShow Samples. You can get its source code by installing Windows SDK. There might be someone distributing prebuit binary for MinGW.

lukes
  • 183
  • 1
  • 9
0

Additional note for developers in FreeBASIC under Windows with GTK and C libraries.

For programmers in FreeBASIC it is sufficient to add these definitions to allow the compiler to directly find the directory containing the libraries

    #IF DEFINED(__FB_WIN32__)
    #LIBPATH "C:\msys64\mingw64\lib" 
'for windows '
    #ELSE
    #LIBPATH "/usr/lib"
'for linux '
    #ENDIF
ExagonX
  • 141
  • 10