0

I am relatively new to C++. I am using Windows 7 pro with the g++ (MinGW) compiler (5.1.0) that is delivered with CodeBlocks 17.12.

Questions briefly asked:

What does the below error message (containing .text.startup.+0x82) tell me? I am not sure what .text.startup.+x82 means; does that mean 82 hex bytes from the beginning of the referenced file?

I am a beginner when it comes to resolving codeblock's undefined reference errors. Can someone give me a clue as to what codeblocks (with the Mingw compiler) is complaining about here? I believe zlibcomplete.hpp is correctly included in my project as the compiler gets past this line of code without complaining:

#include <zlc/zlibcomplete.hpp>

Two of six error messages I received (all 6 are similar to these two):

obj\Release\main.o:main.cpp:(.text.startup+0x82)||undefined reference to `zlibcomplete::ZLibCompressor::ZLibCompressor(int, zlibcomplete::flush_parameter, int)'|

obj\Release\main.o:main.cpp:(.text.startup+0x130)||undefined reference to `zlibcomplete::ZLibCompressor::compress(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'|

Detailed description of what I've done so far (offered in case the above is not clear or sufficient):

I downloaded and successfully compiled the most recent zlib package (1.2.11). To get more experience with zlib I downloaded an interface to the zlib library called zlibcomplete ( from here: https://github.com/rudi-cilibrasi/zlibcomplete ).

I am new to Cmake, but believe I successfully built zlibcomplete using cmake's gui interface; at least I didn't see any error messages after configuring then generating zlibcomplete's cmake files (after several attempts).

Now, I am trying to compile a zlibcomplete example program with codeblocks. I started by creating a minimal codeblocks console project (which defaults to a simple hello world project; I built the default project and it worked and ran ok). Then I replaced the main function from that codeblocks default minimal console project with the code from one of the zcomplete example project. I had to add a few directories to codeblock's project level linker search directory but got stuck (not knowing what to do) when I received the above error messages.

Thank you in advance.

Valentino
  • 7,291
  • 6
  • 18
  • 34
Ken_sf
  • 89
  • 1
  • 9
  • Possible duplicate of [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – walnut Sep 21 '19 at 15:55
  • Particularly [this answer](https://stackoverflow.com/a/12574400/11941443). – walnut Sep 21 '19 at 15:57
  • Also: https://stackoverflow.com/questions/5862757/how-do-i-link-to-a-library-with-codeblocks – walnut Sep 21 '19 at 15:59
  • Thank you. I have read the 'possible duplicate' in the past; the others are new. I will study. I've had some success eliminating undefined reference errors, however, this one stumped me; it doesn't appear to be from a missing linked library. What would help most in my search is to learn what object the compiler is referencing when it lists this in the build messages log: "zlibcomplete::ZLibCompressor::ZLibCompressor(int, zlibcomplete::flush_parameter, int)"? What does the first 'zlibcomplete' refer to? I believe I understand the second two that begin with a capital Z. – Ken_sf Sep 21 '19 at 16:54
  • `zlibcomplete` is a namespace for the library, the first `ZlibCompressor` is a class name in that namespace and the second `ZlibCompressor` is a constructor with the following parameter list in the that class. The whole thing is a demangled symbol, the name for a code reference in an object file or library. It is [defined here](https://github.com/rudi-cilibrasi/zlibcomplete/blob/master/lib/zlibmisc.cpp#L9). You will need to check the actual compiler command line executed ([it should contain `-lzlibcomplete`](https://github.com/rudi-cilibrasi/zlibcomplete#usage)). – walnut Sep 21 '19 at 17:09
  • Thank you uneven_mark. This is the answer/explanation I was looking for. I will try to figure out out to mark your response as the answer to my post. Sorry, if this was handled by other posts referenced ealier. – Ken_sf Sep 21 '19 at 17:19

0 Answers0