hey guys,
total newbie question here, but on this program I am writing I am, all of the sudden, getting an error saying "redefinition of 'show_all_passengers' ", and I'm not sure why this is happening.
Any help is really appreciated,
thanks,
John
This is a discussion on function redefinition error within the C Programming forums, part of the General Programming Boards category; hey guys, total newbie question here, but on this program I am writing I am, all of the sudden, getting ...
hey guys,
total newbie question here, but on this program I am writing I am, all of the sudden, getting an error saying "redefinition of 'show_all_passengers' ", and I'm not sure why this is happening.
Any help is really appreciated,
thanks,
John
You probably have an object (show_all_passengers) in a header somewhere that's getting included multiple times which to the compilers point of view is attempting to have several different objects with the same name created (this is bad). If this is the case, remove the objects declaration from the header (or at least make it "extern" within the header) and make sure an actual declaration exists only in a single source file.
... or something along those lines.
I used to be an adventurer like you... then I took an arrow to the knee.
If indeed the compiler is reincluding a header more than once, you should look up "include guards":
Include guard - Wikipedia, the free encyclopedia
Some compilers support the following:Code:/* contents of myheader.h */ #ifndef MYHEADER_H #define MYHEADER_H /* code here */ #endif
which tells the compiler to only use that header once.Code:/* first line of your header file */ #pragma once
-Jake
Hazudra Fodder