0

I am trying to add a header file into another header file but it says "Source file not compiled" Is there something wrong with what I am trying to do?

#include "\\Mac\Home\Desktop\BSD 2017\Study\BTP100SCC.05062.2177 Programming Fundamentals Using C\BTP-Project\A1\MS2\contacts.h"

struct Name
 {
    char firstName[31];
    char middleInitial[7];
    char lastName[36];

};
kmdreko
  • 42,554
  • 6
  • 57
  • 106
s.younas
  • 11
  • 5
  • 1
    Please add your code, so we can help you. – akshayk07 Oct 24 '17 at 03:14
  • Can you let us know if the code is complied. If it is still compiled and you are getting the same error delete the output executable and compile it again. – shri Oct 24 '17 at 03:52
  • check here to see if it solves your issue: https://stackoverflow.com/questions/14514682/source-file-not-compiled-dev-c – kmdreko Oct 24 '17 at 03:52
  • You shouldn't use such a long header path in your code. The location should be specified on the command line (`-I` option on Unix), and either `"contacts.h"` or perhaps `"MS2/contacts.h"` in the code. Using backslashes vs slashes suggests you're on Windows. Be cautious. Slashes normally work as well as backslashes. – Jonathan Leffler Oct 24 '17 at 04:14

1 Answers1

1

Short answer for a short question. No #include "file.h" should work fine.

"Source file not compiled" indicates that you may not have compiled your source file. Have you run a command such as % gcc -c file.c?

**edit: listing your full directory each time is bad practice. Use the -I option to specify the directory search path

If you have not done this, then you should read up on how to compile a c program.

Note: If you run windows you may need to use a Unix command-line environment such as Cygwin

Jesse
  • 283
  • 1
  • 5
  • 14