Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
the compiler kicks out "undefined symbol mbed::country_count" when I try to compile the following. I thought that I was defining country_count in the countries.h header but apparently not - what am i doing wrong here guys??
//countries.h #ifndef mbed_countries_H #define mbed_countries_H #include "mbed.h" namespace mbed { struct country_data { const char *pref; const char *name; short int lat, lon; }; extern const country_data country_table[]; extern const int country_count; const country_data country_table[] = { {"1A","SMO MALTA",42,13 }, {"1S","SPRATLY IS",9,112 }, }; } #endif ______________________________ //main.cpp #include "mbed.h" #include "countries.h" void dxcc() { printf("count = %d \n", country_count); } int main() { const int country_count = sizeof(country_table) / sizeof(country_table[0]); dxcc(); }