   Importance of const and Linking Errors
  Hello,I am creating a C++ application from a number of C source and header files.  In one of the header files there is struct that has a const char[] member.  If I leave that member in the struct, and I try to use the struct in my C++ application, then I get an error that says "no appropriate default constructor."  If I remove const qualifier, I get numerous LNK2019 errors.  I checked all the functions that come up in the LNK2019 errors but none of them use or contain that struct at all.  I've never ran into something like this before.I guess another thing is, since I have never tried to integrate C and C++ code before, that I am not sure how to declare the struct in my C++ app.  I am assuming I am doing it right, but we all know what happens when you assume.Here's an example of the struct in the header file:typedef struct _Test {const signed char[64];int a;void *ptr;} Test;Implementation in C++ main():Test foo;   
  Wouldn't it be possible to compile the C files as C? You might find some directions here.   ;  I have tried using extern "C" by encompassing the struct, the whole header, and the variable in the cpp application file.  I am not sure what's going on behind the scenes.   ;  Well, that structure is wrong from both a C and C++ point of view.  If the array is const, how are you supposed to store characters in it?If you're intention is to say that you won't modify the array of characters in a function, then you want to pass in the struct as a pointer to const.Of course, that structure also sports the evil void *.You should make up your mind whether or not you want this code to be C or C++.;  visitor,Thank you for your response.  By encompassing the header files, which contained the function prototypes for the linking errors, with#ifdef __cplusplusextern "C"#endif// Header file code...#ifdef __cplusplus}#endifthe linking errors were eliminated and I now have a successful build (at least for now :) )I also removed the "const" qualifier from the struct in the header file.   ;Quote:Original post by legalizeIf the array is const, how are you supposed to store characters in it?By initializing it.struct Test{    const char str[64];};int main(){    Test foo = {"hello world"};}