LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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
  Search this Thread
Old 12-02-2009, 12:39 AM   #16
eryn
Member
 
Registered: Jul 2009
Posts: 43

Original Poster
Rep: Reputation: 15

Thank you John Graham.

I solved the second problem easily with your solution.

But, I still having problem with the first problem.
I search through the usr/include directory and also usr/local/include directory and I cannot find any header file of name memory.h.
Anyway, I still rename the header file to become BRBmemory.h and compile again. I still get the same error message.

I also tried to substitute it with other defined constant in the BRBmemory.h. It still giving the same error.

Last edited by eryn; 12-02-2009 at 03:51 AM.
 
Old 12-02-2009, 07:19 AM   #17
JohnGraham
Member
 
Registered: Oct 2009
Posts: 467

Rep: Reputation: 139Reputation: 139
Okay - first things to check:

1) Is BRBmemory.h #included in ProjectApplication.h?

2) If so, could you please post the complete output of trying to compile it?
 
Old 12-02-2009, 07:23 PM   #18
eryn
Member
 
Registered: Jul 2009
Posts: 43

Original Poster
Rep: Reputation: 15
No.

The included header file in ProjectApplication.h are
ProjectFunctionLayer.h
QLibrary

In ProjectFunctionLayer.h, the included header files are
QString
BRBmemory.h

TeamProtocol.h
.
.
.

Using these, the compiler cannot find the NUM defined in BRBmemory.h that is memory.h previously.

I get information on the net that when a value is defined, it is only available in the file that defined it and the file that include the file that defined it. Is this means NUM is only available in BRBmemory.h and ProjectFunctionLayer.h but not ProjectApplication.h?

Isn't my ProjectApplication.h can read the NUM as it included ProjectFunctionLayer.h which includes BRBmemory.h that have the definition of NUM?

I tried to add option -Dthedefine=its_value and pass to gcc. It works.
Or I have to manually include BRBmemory.h in ProjectApplication.h itself to eliminate that error.
But I wish not to modify the code been provided.

Last edited by eryn; 12-02-2009 at 09:51 PM. Reason: Adding comment
 
Old 12-03-2009, 06:45 AM   #19
JohnGraham
Member
 
Registered: Oct 2009
Posts: 467

Rep: Reputation: 139Reputation: 139
Quote:
Originally Posted by eryn View Post
I get information on the net that when a value is defined, it is only available in the file that defined it and the file that include the file that defined it. Is this means NUM is only available in BRBmemory.h and ProjectFunctionLayer.h but not ProjectApplication.h?
No, that's completely wrong - if you're sure that:

1) ProjectApplication.h #include's ProjectFunctionLayer.h, and

2) ProjectFunctionLayer.h #include's BRBmemory.h

then you *should* have access to things defined in BRBmemory.h from source files that #include ProjectApplication.h.

My first suspicion is that you're using include-guards, and two of your files have the same one. This would mean that when you try and include the second one, it thinks it's already been included, so just skips to the end of the file, leaving you with nothing from that file.

So, check your include-guards and make sure they define something different (e.g. one defines PROJECT_FUNCTION_LAYER_H and the other BRB_MEMORY_H).
 
Old 12-07-2009, 01:41 AM   #20
eryn
Member
 
Registered: Jul 2009
Posts: 43

Original Poster
Rep: Reputation: 15
Yes, I found include guard in the file, but it includes itself. This means

In ProjectApplication.h,
#ifndef __PROJECTAPPLICATION__
#define __PROJECTAPPLICATION__

#include <ProjectFunctionLayer.h>

#endif

In ProjectFunctionLayer.h,
#ifndef __PROJECTFUNCTIONLAYER__
#define __PROJECTFUNCTIONLAYER__

#include <BRBmemory.h>

#endif
 
  


Reply

Tags
c++, call, function, interface, link



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to call PGPLOT function in FORTRAN code? lengyue Linux - Software 26 12-09-2009 05:36 AM
call a function from library EnTe Programming 4 02-22-2008 06:15 AM
Function for getting the language code in standard library jaepi Programming 1 12-10-2007 01:33 PM
function call in kernel code vishalbutte Programming 1 02-15-2006 01:32 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:27 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration