LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 10-21-2005, 05:52 AM   #1
tristanm
Member
 
Registered: Jun 2005
Location: Pretoria, South Africa
Distribution: Ubuntu, Fedora Core, RHEL
Posts: 37

Rep: Reputation: 15
declaration does not declare anything


I have come across this prpblem twice now when trying to link third party libraries to my program. All the links are correct however I receive the following very strange error:

"declaration does not declare anything)"

This refers to the following line of code in a header file belonging to the third party library:

virtual Int_t Fill(Axis_t x);

Now I believe that this line is declaring a virtual method called Fill which takes an object of type Axis_t and returns an object of type Int_t. I see no problem with the syntax or declaration.
I wonder if I am possible ommitting to include a header file which might solve this problem.

On the other hand has anybody come across anything similar which might help?

Tristan

 
Old 10-22-2005, 09:50 PM   #2
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: Slackware64 13.37, Kubuntu 10.04
Posts: 2,944

Rep: Reputation: Disabled
This function is probably declared outside of a class (such as in a global scope or in a function body). If the compiler says it doesn't do you any good, then it probably doesn't, but I'd leave it and notify the code maintainer in case it should be something else. It might be a hidden bug that no one has caught, or it might be something that otherwise means something to a different compiler. If your implementation works without it, you should leave it. In any case, be sure that the error isn't a result of your implementation, then notify the source of the code.
ta0kira

PS Are you using gcc with the -Wall flag?
 
Old 10-24-2005, 01:27 AM   #3
tristanm
Member
 
Registered: Jun 2005
Location: Pretoria, South Africa
Distribution: Ubuntu, Fedora Core, RHEL
Posts: 37

Original Poster
Rep: Reputation: 15
Thanks. The decleration actually does occur inside a class. I have posted to a forum belonging to one application where this occurred and I will see what happens.

I am using gcc. What is the significance of the -Wall flag?

Tristan
 
Old 10-24-2005, 08:43 AM   #4
lowpro2k3
Member
 
Registered: Oct 2003
Location: Canada
Distribution: Slackware
Posts: 340

Rep: Reputation: 30
You're using gcc or g++? Virtual functions and classes are a C++, not C thing. I believe a C compiler wouldn't know what to do with them...

The -Wall switch turns on all warnings that might otherwise be hidden.
 
Old 10-24-2005, 09:13 AM   #5
tristanm
Member
 
Registered: Jun 2005
Location: Pretoria, South Africa
Distribution: Ubuntu, Fedora Core, RHEL
Posts: 37

Original Poster
Rep: Reputation: 15
I thought that g++ was part of the gcc compiler suite. I was under the impression that gcc was the GNU compiler and could compile a number of different languages. I assumed that g++ was the C++ part of gcc.

Am I right here? If not how does it really work?
 
Old 10-24-2005, 04:00 PM   #6
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: Slackware64 13.37, Kubuntu 10.04
Posts: 2,944

Rep: Reputation: Disabled
g++ and gcc can both compile C++. g++ is just a version that looks for includes in different places and links to different libs; if your code doesn't use std includes, then gcc should compile and link it fine.

If it's in a class, it might be the declaration of x (isn't needed; could just say Fill(Axis_t) since the function isn't defined here.) Otherwise the function might not be defined for this class. Just as a test, change it to "virtual Int_t Fill(Axis_t x) = 0;" and see if you get a compiler error and post what happens (I have a few ideas dependent on what the result is.)

The -W flag is for warnings, and "all" denotes all warnings, so -Wall means you will get every warning possible.
ta0kira
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
declare and initialize variables in a header file alaios Programming 3 09-04-2005 04:25 AM
How to declare a defaul argument in my function? bigapple Programming 3 08-11-2005 10:27 PM
g++ compiler error declaration does not declare anything Basiltp Programming 4 10-11-2004 11:29 AM
Help for perl--- Getopt::Declare arobinson74 Programming 1 08-20-2004 10:31 AM
How to declare constant strings in C/C++? Dark_Helmet Programming 3 05-29-2004 08:07 AM


All times are GMT -5. The time now is 04:41 AM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration