LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-07-2007, 03:51 AM   #1
advanxiang
LQ Newbie
 
Registered: May 2007
Posts: 20

Rep: Reputation: 0
gcc problem


hi,everyone,
I wrote a testing routine in linux in order to test gcc compiled link symbol ## in macro , gcc version under 3.2.2(3.2.2 and 2.9.5) was able to compile this routine ,only with waring . but I used gcc-3.3.2 and gcc-4.1.1 to compile it ,it wasn't be compiled successfully .
<source codes below post>
I want to know why , if I want to solve this problem with gcc-3.3.2 or gcc-4.1.1 ,How to do ? if anybody knows this issue ,please tell me or give a clue .
thank you in advance
advan
 
Old 08-07-2007, 03:51 AM   #2
advanxiang
LQ Newbie
 
Registered: May 2007
Posts: 20

Original Poster
Rep: Reputation: 0
testing.c
#include <stdlib.h>
#include <stdio.h>
/*this is only a testing rounte*/
#define R_ONLY_TYPE 1
#define W_ONLY_TYPE 2
#define RW_TYPE R_ONLY_TYPE+W_ONLY_TYPE
typedef unsigned short u16;
typedef unsigned char u8;
typedef struct _info_t{
u8 uname[32];
}info_t;
typedef struct _link_info_t{
u16 type;
u16 size;
u8 *pname;
}link_info_t;
info_t Test_s;
#define LINK_TABLE(type,name) {type, sizeof(Test_s##.##name), (u8*)&(Test_s##.##name)}
int main()
{
int i;
strcpy(Test_s.uname,"Testing");
Test_s.value = 0x0a;
link_info_t table[]={
LINK_TABLE(RW_TYPE,uname),
};
for(i=0;i<sizeof(table)/sizeof(link_info_t);i++)
printf("varname[%s],type[%d],size[%d]\n",table[i].pname,table[i].type,table[i].size);
return 0;
}
 
Old 08-07-2007, 07:48 AM   #3
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
post the error you get
 
Old 08-07-2007, 08:22 PM   #4
advanxiang
LQ Newbie
 
Registered: May 2007
Posts: 20

Original Poster
Rep: Reputation: 0
gcc-3.2.2 : get info
testc.c:25:25: warning: pasting "Test_s" and "." does not give a valid preprocessing token
testc.c:25:25: warning: pasting "." and "uname" does not give a valid preprocessing token
testc.c:25:25: warning: pasting "Test_s" and "." does not give a valid preprocessing token
testc.c:25:25: warning: pasting "." and "uname" does not give a valid preprocessing token


gcc-3.4.4 : get info
testc.c:25:1: pasting "Test_s" and "." does not give a valid preprocessing token
testc.c:25:1: pasting "." and "uname" does not give a valid preprocessing token
testc.c:25:1: pasting "Test_s" and "." does not give a valid preprocessing token
testc.c:25:1: pasting "." and "uname" does not give a valid preprocessing token
 
  


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
Solved Problem Second GCC-Pass(or gettext sanity check problem) hoes Linux From Scratch 0 09-04-2005 10:20 AM
problem in 6.14 GCC-3.4.3 Soltar Linux From Scratch 2 08-25-2005 02:57 PM
problem with gcc ptwobrussell Linux - Software 4 09-08-2003 04:58 PM
gcc 3.2-7 problem necromancer Programming 7 03-04-2003 01:04 PM
GCC problem drjimstuckinwin Linux - General 1 08-23-2001 06:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:26 PM.

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