dcsimg
Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: C++
Expertise: Beginner
Dec 1, 1999

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


Implicit Function Declaration

Question:
I am a Computer Science student, and I am trying to compile a program where I use multiple files and my own header file for the first time. But I'm having some trouble. I get an error that says:
 
driver.cc: In function `int main(...)':
driver.cc:34: warning: implicit declaration of function `int dev(...)'
driver.cc:35: warning: implicit declaration of function `int output(...)'
I thought this meant that the function was not defined anywhere else, but I thought the header file and attached file with the definitions did that.

Do you know what I am doing wrong?

Answer:
It looks like you're calling functions before the compiler has seen their declarations/definitions. In C, this is legal (although deprecated). In C++, however, it's illegal. Because many C++ compilers are also C compilers, you receive a warning rather than an error message.

Make sure the prototypes of the functions dev() and output() appear before they are actually called.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date