Struct as return type


 
Thread Tools Search this Thread
Top Forums Programming Struct as return type
# 1  
Old 02-02-2015
Struct as return type

Hello all,
I am trying to define a function with return type as struct, but seem to be failing.

Error I am receiving is following

Code:
.CC error: prototype for 'RpcHOData L1ITMu::MBLTCollection::getUnassociatedHORpcClusters(double)' does not match any in class 'L1ITMu::MBLTCollection'
 struct RpcHOData L1ITMu::MBLTCollection::getUnassociatedHORpcClusters( double minRpcPhi ) 
                  ^
In file included from .h error: candidate is: L1ITMu::MBLTCollection::RpcHOData L1ITMu::MBLTCollection::getUnassociatedHORpcClusters(double)
      struct RpcHOData  getUnassociatedHORpcClusters( double minDist);

Please find the snippet of the code here:
Code:
in .h file --->

namespace L1ITMu {
  class MBLTCollection {

  public:

    struct RpcHOData {
      std::vector< L1ITMu::TriggerPrimitiveList> In;
      std::vector< L1ITMu::TriggerPrimitiveList> Out;
      std::vector< L1ITMu::TriggerPrimitiveList> ho;
    };

}

in CC file --->

struct RpcHOData L1ITMu::MBLTCollection::getUnassociatedHORpcClusters( double minRpcPhi )
{
 .....
 ......
}


Any piece of suggestions would be great.

Thanks in advance,
emily

---------- Post updated at 09:44 AM ---------- Previous update was at 09:40 AM ----------

I forgot to add,
I also tried removing the keyword 'struct' in the return type, did not help either.

Code:
in CC file --->

 RpcHOData L1ITMu::MBLTCollection::getUnassociatedHORpcClusters( double minRpcPhi )
{
 .....
 ......
}

error is then:
Code:
.CC error: 'RpcHOData' does not name a type
 RpcHOData L1ITMu::MBLTCollection::getUnassociatedHORpcClusters( double minRpcPhi )

---------- Post updated at 09:58 AM ---------- Previous update was at 09:44 AM ----------

resolved..Smilie Smilie

the issue was the scope in ,cc file
# 2  
Old 02-05-2015
The following in the cc file should do the trick, the struct wasn't defined globally:

Code:
L1ITMu::MBLTCollection::RpcHOData L1ITMu::MBLTCollection::getUnassociatedHORpcClusters( double minRpcPhi )

Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Programming

Storing C++-struct in file - problem when adding new item in struct

Hi, I have received an application that stores some properties in a file. The existing struct looks like this: struct TData { UINT uSizeIncludingStrings; // copy of Telnet data struct UINT uSize; // basic properties: TCHAR szHost; //defined in Sshconfig UINT iPortNr; TCHAR... (2 Replies)
Discussion started by: Powerponken
2 Replies

2. Programming

Problem with implementing the times() function in C (struct tms times return zero/negative values)

Hello, i'm trying to implement the times() function and i'm programming in C. I'm using the "struct tms" structure which consists of the fields: The tms_utime structure member is the CPU time charged for the execution of user instructions of the calling process. The tms_stime structure... (1 Reply)
Discussion started by: g_p
1 Replies

3. HP-UX

struct utsname throwing error : Value too large to be stored in data type

Hi, I am trying to fetch sysname and nodename using struct utsname. I have two HP-UX servers on with 10 characters and other with 13 characters host name. For the first one I am getting truncated 8 characters as output but for the second one i am getting "Value too large to be stored in data type"... (1 Reply)
Discussion started by: shivarajbm
1 Replies

4. Shell Programming and Scripting

what is the default return type of localtime() in perl?

Hi, I have given like this to get the time of the sub routine. my $start = localtime(); print "\n start time: $start \n"; Output start time: Fri Apr 29 01:01:31 2011 I want to know what is the format of the time. I am not able to follow is is HH:MM:SS or MM:HH:SS os... (2 Replies)
Discussion started by: vanitham
2 Replies

5. UNIX for Dummies Questions & Answers

How to access a struct within a struct?

Can someone tell me how to do this? Just a thought that entered my mind when learning about structs. First thought was: struct one { struct two; } struct two { three; } one->two->three would this be how you would access "three"? (1 Reply)
Discussion started by: unbelievable21
1 Replies

6. Shell Programming and Scripting

Find command return type

Hi all does find command return anything if the file to be searched is not found? Like if I search from a file in a dir does it return false or null if the file is not found? Please suggests. (3 Replies)
Discussion started by: Veenak15
3 Replies

7. Programming

array type has incomplete element type

Dear colleagues, One of my friend have a problem with c code. While compiling a c program it displays a message like "array type has incomplete element type". Any body can provide a solution for it. Jaganadh.G (1 Reply)
Discussion started by: jaganadh
1 Replies

8. Programming

Help - Cast converts default int return type

What does the warning message 724 "Cast converts default int return type to." tell me. I am new to C. (used it some in college). We are migrating our c-code to 10.2.0.3.0. The programs compiled clean. However there were several warning messages that kick out. The most prominent warning is: ... (5 Replies)
Discussion started by: rtgreen
5 Replies
Login or Register to Ask a Question