Archived

This topic is now archived and is closed to further replies.

Nullio

Another Linking/compileing Questions

Recommended Posts

With discipline (no kidding). Knowing the purpose of the each #include helps too. As well as using forward declarations to avoid header inclusion recursion.

AFAIK, there is no other secret.

Share this post


Link to post
Share on other sites
"#include statements" dont cause linking errors, they cause compiling errors

for inclusion-recursion you just have to put

#ifndef MYHEADER_H
#define MYHEADER_H

at the top of your header file (replacing "MYHEADER" for say, the filename of the header) then write all your prototypes and declarations, at the end you add

#endif // MYHEADER_H

other than that not including a header, including the header but not the lib (which by the way is what causes linking errors), not setting an alternate include or lib path in cases where it is required is what causes compilation and llinking problems

Share this post


Link to post
Share on other sites