Question Locked

C++

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I have an include file named "myinclude.h", have a number of variables define. I call another C routine from a file that includes the variable file .h. I also include the "myinclude.h" file in the called routine. However, non of the variables in the .h file are included, compiler says "undefined variable" when I reference. Any ideas why the included file is not recognized in the called routine? Sid kraft

3 replies

by blasiu

I'm not sure if I understand what you have in mind saying >>I also include the "myinclude.h" file in the called routine<<. Can you provide an example of which files include what and where you can't access which variables? Also, are you 100% sure that your .h files are in the project path?

by adrian_wrobel

You should define this varible in file where you try to call routine but this time withe "extern" word. For example: extern int a;

This discussion is closed to new replies.