i made small program which does some functions and i tested it and it worked as i wish.
Then i add its .h and .cpp files to another program to use it but when i add the .cpp file it gives me 100s of errors related to boostmultiindex which i use in the added .cpp file.
i do not know what is happening.
the errors include the following"this is sample of errors":
Error C2516 'boost::mpl::if_<C,F1,F2>::type': is not a legal base class
Error C2039 'type': is not a member of 'boost::iterators::iterator_category_to_traversal<int>'
Error C3203 'type': unspecialized class template can't be used as a template argument for template parameter 'U', expected a real type
Error C2653 'safe_mode': is not a class or namespace name
Error C2143 syntax error: missing ',' before '<'
i did not attach code or files because i do not know where to start.
i can update the post based on any guidance.
update:
i think the problem is related to certain header file which i put in it most includes for all my cpp files.
this might lead to cyclic dependency problem which might led to ignoring some includes.
because when i exclude this large include file the errors are much decreased.
i will try to reorder the includes and see if they make difference.
update:
now i commented two lines in the large include file and it removed the errors related to this problem.
the two lines are:
//??#include "modules/utils/utils.h"
//??#include "modules/utils_dst/utils_dst.h"
i do not why these two lines makes these errors
is it related to the fact that the two files are in subdirectories???
Make sure of the following:
When including the .h
and .cpp
files that you have the full path not just the name of the file.
There are no variables, functions, etc. having the same name/signature in both the files your including and the project file you are including to. If there is, then use namespace
to differentiate between conflicts.
You have added all dependencies of the files you want to include to the file you want to include into.