LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 01-05-2010, 12:27 AM   #1
gagan_bhagat
LQ Newbie
 
Registered: Jan 2010
Posts: 3

Rep: Reputation: 0
g++ gives compilation error


in the program given below , while i am trying to compile it gives error.
In function `int main()':
error: `struct GSMRegisterSS_RESULT::GSM_seq11' has not been declared
error: `GSM_seqof202' has not been declared
NOTE :
It is auto generated code for .h file so i cant change any thing in the structure or in the union.


#include<iostream>
using namespace std;

typedef struct GSMRegisterSS_RESULT {
union {

struct GSM_seq11 {

struct GSM_seqof202 {
int code;
}*forwardingFeatureList;

}forwardingInfo;

}u;


}GSMRegisterSS_RESULT;

int main()
{
GSMRegisterSS_RESULT ss;
ss.u.forwardingInfo.forwardingFeatureList=new GSMRegisterSS_RESULT::GSM_seq11::GSM_seqof202;
return 0;
}

Last edited by gagan_bhagat; 01-05-2010 at 12:42 AM.
 
Old 01-05-2010, 12:36 AM   #2
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
The error is?
 
0 members found this post helpful.
Old 01-05-2010, 03:56 AM   #3
gagan_bhagat
LQ Newbie
 
Registered: Jan 2010
Posts: 3

Original Poster
Rep: Reputation: 0
Hi smeezekitty,

while i am trying to compile it gives error.
In function `int main()':
error: `struct GSMRegisterSS_RESULT::GSM_seq11' has not been declared
error: `GSM_seqof202' has not been declared
 
Old 01-05-2010, 11:02 AM   #4
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,781

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
The only way I could manage is using templates:
Code:
#include<iostream>
using namespace std;

typedef struct GSMRegisterSS_RESULT {
    union {

        struct GSM_seq11 {

            struct GSM_seqof202 {
                int code;
            }*forwardingFeatureList;

        }forwardingInfo;

    }u;

}GSMRegisterSS_RESULT;

template<typename T>
T* mknew(const T *) {
    return new T();
}

int main()
{
    GSMRegisterSS_RESULT ss;
    ss.u.forwardingInfo.forwardingFeatureList =
        mknew(ss.u.forwardingInfo.forwardingFeatureList);
    return 0;
}
If there is some way to refer to anonymous types, I'd be interested to see it.
 
Old 01-05-2010, 12:04 PM   #5
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
I don't have time to test this myself now, but what about using the gcc extension typeof

Maybe:

ss.u.forwardingInfo.forwardingFeatureList=new typeof(*
ss.u.forwardingInfo.forwardingFeatureList);
 
Old 01-05-2010, 11:45 PM   #6
gagan_bhagat
LQ Newbie
 
Registered: Jan 2010
Posts: 3

Original Poster
Rep: Reputation: 0
thanks to all of u for the help.
 
  


Reply



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
unable to resolve compilation error;./List.c:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ amolgupta Programming 3 01-09-2009 10:09 AM
Inkscape compilation error: *** [extension/internal/pdfinput/pdf-parser.o] Error 1 w1k0 Slackware 12 10-25-2008 09:53 AM
compilation error : /tmp/cczC6Kc3.s:7368: Error: unknown pseudo-op: `.ltorg' nankie Red Hat 0 08-19-2008 10:15 AM
Error during the compilation of Prozilla. How to correct the recursive error? deepumnit Linux - Software 1 01-10-2008 11:02 AM
Kernel compilation error: Error 15: File not found Niceman2005 Linux - General 9 10-04-2007 03:45 AM

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

All times are GMT -5. The time now is 11:16 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