0

Note: I am new to c++. I had an existing solution with multiple projects that I was able to create a new project/.cpp file and include the .h file successfully(ie, compile and run the executable as expected) in one of the application's lower level files/projects. However, when I include the header for my file at the top level .cpp file/entry point for the application, several syntax errors are returned regarding log4cpp/category.hh.

After some searching I it seems it might be caused by a conflict between log4cpp and boost (I have 1.55) based on some SO questions. The existing solution has the log4cpp includes, and my .h/.cpp has the boost\filesystem.hpp include.

When I open category.hh, the errors point to 2 lines, each with 'Priority::ERROR'. The errors include "'constant': illegal token on right side of ::" and "function does not take 0 arguments".

Looking at Priority.hh, they have a typedef enum {} for various levels of priority. When I hover the cursor over each enum, all of them have an associated integer value except for ERROR.

What is strange to me is that the file I originally included my header in also has the log4cpp #includes, and does not throw any errors. The two locations are in different projects however.

With my knowledge of c++ I'm just not sure of how to go about resolving/debugging this. Is there a certain project property/setting I need to look for that would cause it to fail in one project but not the other? Any help is greatly appreciated.

user2415349
  • 5
  • 1
  • 5
  • Are you placing "using namespace whatever" in your header files? If so, stop doing that and place using clauses in source modules, not header files. `When I hover the cursor over each enum, all of them have an associated integer value except for ERROR.` You shouldn't rely on Intellisense or other utility as a substitute for actually learning the language and knowing where definitions are coming from. – PaulMcKenzie Mar 31 '14 at 15:40
  • No, the code does not have any "using namespace .." statements. Regarding the latter, I'm in the process of learning, but am not sure of the next step as the location in priority.hh I refer to is where the enum is defined. – user2415349 Mar 31 '14 at 15:46

0 Answers0