Thread: Header File Trouble

  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    26

    Header File Trouble

    Now I know there's been a bunch of message board threads regarding this, but I've already searched for them and I followed the steps but I keep getting compiler errors from the mingw compiler.

    I'm using an IDE probably no one's ever heard of. It's called Quincy 2005.

    That's besides the point though, the problem is I had this working like last week and now it won't work!

    I created a header file "myStringFunc.h" using the header file creator in the IDE.
    I created a .c file called myStringFunc.c and defined the functions as well as included the "myStringFunc.h" file. The header file and .c file are in the same directory.

    I wrote main and compiled both myStringFunc.c and main.c and I tried building main and the compiler gives me "undefined reference to function [blah].

    It won't let me copy the error, but I don't understand why it's not working because I had it working last week.

    The only way I know I can fix it is if I put it in a project file or include the .c file, but I don't want to do that if I had it working!

    If someone can spare some time to help or point me somewhere besides the C programming FAQ (already read it) that would be of great help... thanks.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Do you include the .h file in your main.c?

  3. #3
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    Quote Originally Posted by jake123 View Post
    If someone can spare some time to help or point me somewhere besides the C programming FAQ (already read it) that would be of great help... thanks.
    It sounds like an IDE issue regarding setting up your project with multiple source files. So its FAQs would be the place to look.

    [edit]Something like a Project->Add Files... type thing comes to mind.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  4. #4
    Registered User slingerland3g's Avatar
    Join Date
    Jan 2008
    Location
    Seattle
    Posts
    603
    The statement "header file creator in the IDE" sounds very fishy to me. Also the IDE will not let you copy the error message? Anyways, to me, it sounds like you should upgrade your IDE. There is heavy talk here about going to Visual Studio. If you are a student that is free for the time being.

    If you like free, check out NetBeans 6.0. As that is what I use on Ubuntu.

    Can you possibly elaborate a bit more on how you are actually declaring your functions in your .h and how they are getting called from your .c.

  5. #5
    Registered User
    Join Date
    Feb 2008
    Posts
    26
    Quote Originally Posted by tabstop View Post
    Do you include the .h file in your main.c?
    Yes I did.


    Quote Originally Posted by Dave_Sinkula View Post
    It sounds like an IDE issue regarding setting up your project with multiple source files. So its FAQs would be the place to look.

    [edit]Something like a Project->Add Files... type thing comes to mind.
    I know I can probably fix it by doing that and the help isn't very specific about compiling multiple source files except for creating a project.

    I just swore that I remember getting it to work without creating a project last week...

    I don't know maybe I just can't remember. It most likely is an IDE issue.

  6. #6
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    In the help files, something like this?
    file:///C:/Program%20Files/quincy/html/quincy2005/projects.htm
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  7. #7
    Registered User
    Join Date
    Feb 2008
    Posts
    26
    Quote Originally Posted by slingerland3g View Post
    The statement "header file creator in the IDE" sounds very fishy to me. Also the IDE will not let you copy the error message? Anyways, to me, it sounds like you should upgrade your IDE. There is heavy talk here about going to Visual Studio. If you are a student that is free for the time being.
    Visual Studio '08 is only free for selective Universities. I'll probably be able to get it, but I'll have to go back to school to get my MSDN password. I'm on co-op term right now.

    I should elaborate on "header file creator" what I meant is every time I add a file, it let's me specify which type of file to add .c, .h, .prj etc. so I chose header file so the IDE treats it as one. I just wanted to make it clear. Sorry if it caused confusion.

    Your right I should get a new IDE, but most IDE's require the creation of project files and I'm just learning C so I'm only writing console apps right now, so I don't have the use for a large IDE.

    If you want me to post my source code I will, just let me know.

  8. #8
    Registered User
    Join Date
    Feb 2008
    Posts
    26
    Quote Originally Posted by Dave_Sinkula View Post
    In the help files, something like this?
    file:///C:/Program%20Files/quincy/html/quincy2005/projects.htm
    I'm familiar and like I said that probably will work.

    It's not that big of a deal anyways, I just probably forgot and I probably did use a project, I just can't remember.

    A moderator can mark this forum as read if they want to, I don't want to bother anyone with a vague issue such as this.

  9. #9
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    > I'm using an IDE probably no one's ever heard of. It's called Quincy 2005.
    Not true, I use Quincy all the time for PAWN (Small C)

  10. #10
    Registered User
    Join Date
    Feb 2008
    Posts
    26
    Oh yeah, thanks to everyone for the help and advice. I appreciate it.

  11. #11
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by jake123 View Post
    Visual Studio '08 is only free for selective Universities. I'll probably be able to get it, but I'll have to go back to school to get my MSDN password. I'm on co-op term right now.
    That's not true. It's free for all students. But they may not have added your specific university to the list yet. But there are other validation methods, however, so don't be discouraged.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  12. #12
    Registered User slingerland3g's Avatar
    Join Date
    Jan 2008
    Location
    Seattle
    Posts
    603
    Quote Originally Posted by Elysia View Post
    That's not true. It's free for all students. But they may not have added your specific university to the list yet. But there are other validation methods, however, so don't be discouraged.
    I believe you have to re-license the product every year through DreamSpark.

  13. #13
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Doesn't mean it's less free, however.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Formatting a text file...
    By dagorsul in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 03:53 AM
  2. Need help understanding Header Files
    By Kaidao in forum C++ Programming
    Replies: 11
    Last Post: 03-25-2008, 10:02 AM
  3. Header File Trouble... Again
    By jake123 in forum C Programming
    Replies: 11
    Last Post: 03-10-2008, 03:01 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Replies: 6
    Last Post: 04-02-2002, 05:46 AM