c++ - Are there general guidlines for solving undefined reference/unresolved symbol issues? -


I have many "undefined references" (during the link) and "unresolved symbol" (after runtime after dungeon) The issues are I work. This is a large makefill system.

Are there general rules and guidelines for linking libraries and using compiler flags / options to avoid these types of errors?

You can not avoid this type of error by setting a flag : This means that some units (.cpp) are not the definition of declared identifiers. This is definitely due to the disappearance of object definitions (often static objects) or absent.

While you are developing you can follow these guidelines (to) to ensure that all your CPP covers all the headers that they need but not more:

  • Include your own header file in each CPP file first. This is the most important guideline; Everything from here is the only exception to this rule included in precompiled header view studio; Those people must first be included in the file. More about precompiled headers in two parts of this article.
  • A header file must include all the header files needed to head it. It goes hand in hand with the first guideline. I know that some people have never included in the header files in those files which include files with proficiency in those lines or claiming something. However, if a file should be included before a header file is parsed, then it must be added anywhere. The advantage of directly adding it to the header file is that we can always decide to drag that title file in which we are interested and we are guaranteed that it will do as much as possible. We do not have to play "guess" which other headers you need.
  • The minimum number of header files needed to parse a header file should be the minimum minimum number. In the previous rule it has been said that you must have all that you need in the header file. This rule states that you should not have any other than this explicitly, (or not to add to the first place), excluding useless statements include, after that, use as many announcements as you can. If you have any class references or pointers, then you do not have to include that class' header file; One further reference will do well more efficiently.

But as the commentator suggested, it seems that you are using G ++ ...


Comments