Reputation: 1501
I have a namespace like:
HW.h
#include <select.h>
namespace Hw
{
void setInput(uint8_t type, uint8_t input, ESelect select);
void setParam(uint8_t param, ESelect select);
}
select.h
enum class ESelect
{
Select0,
Select1,
Select2
}
Both of the above are in the same static library. I try to call this from another static library, like this.
Test.cpp
#include<HW.h>
#include<select.h>
Hw::setInput( 0, 2, ESelect::Select0 );
I get the error:
error: ‘Hw’ has not been declared
error: ‘ESelect’ has not been declared
What can be wrong?
Upvotes: 1
Views: 4034
Reputation: 212929
Using #include <some_header.h>
causes the compiler to search the system include directories before any user directories. Many *nix systems have a system header called select.h
already, so you are probably including that instead of your own select.h
.
Change all occurrences of:
#include <select.h>
to:
#include "select.h"
Ditto for #include <HW.h>
.
Ideally you should not use system header names for your own headers, and you should always use ""
for user headers and <>
for system headers.
For future reference, a useful technique for debugging such problems is to use g++ -E ...
or equivalent to see what headers are actually being included.
Upvotes: 4