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 03-28-2008, 02:53 AM   #1
jaepi
Member
 
Registered: Apr 2007
Location: Urban Jungle
Distribution: Ubuntu
Posts: 189
Blog Entries: 1

Rep: Reputation: 30
Strange compiling problem


I tried compiling my program to ubuntu using gcc and i got no errors, how ever when i compile it to opensuse 10.3 I get these error:

/usr/include/sys/types.h:52: error: conflicting declaration ‘typedef __ino64_t ino_t’
/usr/include/linux/types.h:14: error: ‘ino_t’ has a previous declaration as ‘typedef __kernel_ino_t ino_t’
/usr/include/sys/types.h:62: error: conflicting declaration ‘typedef __dev_t dev_t’
/usr/include/linux/types.h:13: error: ‘dev_t’ has a previous declaration as ‘typedef __kernel_dev_t dev_t’
/usr/include/sys/types.h:67: error: conflicting declaration ‘typedef __gid_t gid_t’
/usr/include/linux/types.h:27: error: ‘gid_t’ has a previous declaration as ‘typedef __kernel_gid_t gid_t’
/usr/include/sys/types.h:72: error: conflicting declaration ‘typedef __mode_t mode_t’
/usr/include/linux/types.h:15: error: ‘mode_t’ has a previous declaration as ‘typedef __kernel_mode_t mode_t’
/usr/include/sys/types.h:77: error: conflicting declaration ‘typedef __nlink_t nlink_t’
/usr/include/linux/types.h:16: error: ‘nlink_t’ has a previous declaration as ‘typedef __kernel_nlink_t nlink_t’
/usr/include/sys/types.h:82: error: conflicting declaration ‘typedef __uid_t uid_t’
/usr/include/linux/types.h:26: error: ‘uid_t’ has a previous declaration as ‘typedef __kernel_uid_t uid_t’
/usr/include/sys/types.h:90: error: conflicting declaration ‘typedef __off64_t off_t’
/usr/include/linux/types.h:17: error: ‘off_t’ has a previous declaration as ‘typedef __kernel_off_t off_t’
/usr/include/time.h:105: error: conflicting declaration ‘typedef void* timer_t’
/usr/include/linux/types.h:22: error: ‘timer_t’ has a previous declaration as ‘typedef __kernel_timer_t timer_t’
/usr/include/sys/select.h:78: error: conflicting declaration ‘typedef struct fd_set fd_set’
/usr/include/linux/types.h:12: error: ‘fd_set’ has a previous declaration as ‘typedef struct __kernel_fd_set fd_set’
/usr/include/sys/types.h:248: error: conflicting declaration ‘typedef __blkcnt64_t blkcnt_t’
/usr/include/linux/types.h:114: error: ‘blkcnt_t’ has a previous declaration as ‘typedef long unsigned int blkcnt_t’
 
Old 03-28-2008, 08:01 AM   #2
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Looks like either you're compiling a module as if it were a program or vice-versa.
ta0kira
 
Old 03-31-2008, 03:01 AM   #3
jaepi
Member
 
Registered: Apr 2007
Location: Urban Jungle
Distribution: Ubuntu
Posts: 189

Original Poster
Blog Entries: 1

Rep: Reputation: 30
exactly, i'm compiling a program sir. do you have any idea what seems to be the problem?
 
Old 03-31-2008, 11:44 AM   #4
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Do you include both <sys/types.h> and <linux/types.h> in the file that has the error? Please list the includes for the file that has the error, and also the includes for those files included (if they are your files, too.)
ta0kira
 
Old 03-31-2008, 09:58 PM   #5
jaepi
Member
 
Registered: Apr 2007
Location: Urban Jungle
Distribution: Ubuntu
Posts: 189

Original Poster
Blog Entries: 1

Rep: Reputation: 30
I did'nt include both <sys/types.h> and <linux/types.h>. I am using sys/statvfs but I am also using something from <include/linux/> which is cdrom.h. could this be a problem?
 
Old 04-01-2008, 12:10 AM   #6
jaepi
Member
 
Registered: Apr 2007
Location: Urban Jungle
Distribution: Ubuntu
Posts: 189

Original Poster
Blog Entries: 1

Rep: Reputation: 30
This is really weird because i can compile in Ubuntu but I can't compile in opensuse. What is the difference between these distribution? I can't really understand the conflict made.
 
Old 04-01-2008, 06:38 AM   #7
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
What in <linux/cdrom.h> do you need that you can't get somewhere else?
ta0kira
 
Old 04-01-2008, 07:19 AM   #8
KenJackson
Member
 
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora and others
Posts: 757

Rep: Reputation: 145Reputation: 145
The top of /usr/linux/cdrom.h on my (Mandriva) system has this:
Code:
/*******************************************************
 * As of Linux 2.1.x, all Linux CD-ROM application programs will use this 
 * (and only this) include file.  ...
So apparently the author wants you to delete the #include lines for sys/types.h and sys/statvfs.h.

If that leaves some things undefined or undeclared, maybe you could break your file into two files and only include cdrom.h in one of them.
 
Old 04-01-2008, 11:23 AM   #9
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
You need to make sure that anything that uses one version of a typedef isn't used by something that uses another. In other words, you should probably isolate the use of <linux/cdrom.h> to a single source file and give it an interface .h (if it even needs one) that doesn't use any of those typedefs to avoid malformed binary code. You'll have major problems if one source thinks a type is a different size or sign than another source does, which can easily happen with typedefs that differ source-to-source.
ta0kira

Last edited by ta0kira; 04-01-2008 at 11:25 AM.
 
  


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
strange errors while compiling kernel... rubella Linux - Newbie 1 03-17-2006 03:17 AM
strange error while compiling from source Nadim Slackware 2 08-01-2005 10:59 PM
strange, strange alsa problem: sound is grainy/pixellated? fenderman11111 Linux - Software 1 11-01-2004 05:16 PM
Strange error while compiling xft. alypius Linux - Software 1 06-09-2004 09:05 PM
Strange network problem after compiling new kernel.. katana Linux - General 1 12-19-2002 09:51 AM

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

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