LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 11-29-2006, 05:13 AM   #1
sgriffiths
LQ Newbie
 
Registered: Nov 2006
Posts: 8

Rep: Reputation: 0
Problem compiling after moving to Linux


Hello

I have wrote a peice of C code on Sun Solaris.

When i have tried to compile the code on a linux machine i get the below messages

the compiling options i am using are

'MAKEFILE_OS=Linux' \
'LINK_OPTIONS=-std=c99' \
'CFLAGS=-std=c99 -DVERSION=$(VERSION) -DID=$(ID) -
D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -DLinux' \
'LINK=-Wl,+vnocompatwarnings'


split_field.c:1807: error: syntax error before + token
split_field.c:1808: error: syntax error before + token
split_field.c:1809: error: syntax error before sizeof
split_field.c:1812: error: syntax error before + token
split_field.c:1813: error: syntax error before ‚+‚ token
split_field.c:1814: error: syntax error before ‚+‚ token
split_field.c:1815: error: syntax error before ‚+‚ token
split_field.c:1816: error: syntax error before ‚sizeof‚
split_field.c:1832: error: syntax error before numeric constant
split_field.c:1836: error: syntax error before ‚[‚ token
split_field.c:1849: error: syntax error before string constant
split_field.c:1851: error: syntax error before string constant
split_field.c:1867: error: syntax error before string constant
split_field.c:1869: error: syntax error before ‚[‚ token
split_field.c:1870: error: syntax error before ‚.‚ token
split_field.c:1874: error: syntax error before ‚}‚ token
split_field.c:1885: error: syntax error before numeric constant
split_field.c:1885: warning: type defaults to ‚int‚ in declaration of ‚exit‚
split_field.c:1885: warning: data definition has no type or storage class
split_field.c:1889: error: syntax error before ‚[‚ token
split_field.c:1889: warning: type defaults to ‚int‚ in declaration of ‚check_space‚
split_field.c:1889: warning: data definition has no type or storage class
split_field.c:1890: error: syntax error before numeric constant
split_field.c:1890: warning: type defaults to ‚int‚ in declaration of ‚fwrite‚
split_field.c:1890: error: conflicting types for ‚fwrite‚
split_field.c:1890: warning: data definition has no type or storage class
split_field.c:1893: warning: type defaults to ‚int‚ in declaration of ‚fclose‚
split_field.c:1893: warning: parameter names (without types) in function declaration
split_field.c:1893: warning: data definition has no type or storage class
split_field.c:1895: warning: type defaults to ‚int‚ in declaration of ‚ptr1‚
split_field.c:1895: error: redefinition of ‚ptr1‚
split_field.c:1846: error: previous definition of ‚ptr1‚ was here
split_field.c:1895: warning: initialization makes integer from pointer without a cast
split_field.c:1895: warning: data definition has no type or storage class
split_field.c:1896: warning: type defaults to ‚int‚ in declaration of ‚ptr2‚
split_field.c:1896: error: redefinition of ‚ptr2‚
split_field.c:1847: error: previous definition of ‚ptr2‚ was here
split_field.c:1896: warning: initialization makes integer from pointer without a cast
split_field.c:1896: warning: data definition has no type or storage class
split_field.c:1898: error: syntax error before string constant
split_field.c:1898: warning: type defaults to ‚int‚ in declaration of ‚fprintf‚
split_field.c:1898: warning: data definition has no type or storage class
split_field.c:1900: error: syntax error before string constant
split_field.c:1900: warning: type defaults to ‚int‚ in declaration of ‚fprintf‚
split_field.c:1900: warning: data definition has no type or storage class
split_field.c:1916: error: syntax error before string constant
split_field.c:1916: warning: type defaults to ‚int‚ in declaration of ‚fprintf‚
split_field.c:1916: warning: data definition has no type or storage class
split_field.c:1918: error: syntax error before ‚[‚ token
split_field.c:1918: warning: type defaults to ‚int‚ in declaration of ‚munmap‚
split_field.c:1918: warning: data definition has no type or storage class
split_field.c:1919: error: syntax error before ‚.‚ token
split_field.c:1921: warning: type defaults to ‚int‚ in declaration of ‚munmap‚
split_field.c:1921: warning: parameter names (without types) in function declaration
split_field.c:1921: warning: data definition has no type or storage class
split_field.c:1922: warning: type defaults to ‚int‚ in declaration of ‚pUrn‚
split_field.c:1922: error: redefinition of ‚pUrn‚
split_field.c:1873: error: previous definition of ‚pUrn‚ was here
split_field.c:1922: warning: initialization makes integer from pointer without a cast
split_field.c:1922: warning: data definition has no type or storage class
split_field.c:1923: error: syntax error before ‚}‚ token
split_field.c:1942: error: syntax error before numeric constant
split_field.c:1942: warning: type defaults to ‚int‚ in declaration of ‚exit‚
split_field.c:1942: warning: data definition has no type or storage class
split_field.c:1946: error: syntax error before ‚[‚ token
split_field.c:1946: warning: type defaults to ‚int‚ in declaration of ‚check_space‚
split_field.c:1946: warning: data definition has no type or storage class
split_field.c:1947: error: syntax error before numeric constant
split_field.c:1947: warning: type defaults to ‚int‚ in declaration of ‚fwrite‚
split_field.c:1947: warning: data definition has no type or storage class
split_field.c:1950: warning: type defaults to ‚int‚ in declaration of ‚fclose‚
split_field.c:1950: warning: parameter names (without types) in function declaration
split_field.c:1950: warning: data definition has no type or storage class
split_field.c:1952: warning: type defaults to ‚int‚ in declaration of ‚ptr1‚
split_field.c:1952: error: redefinition of ‚ptr1‚
split_field.c:1895: error: previous definition of ‚ptr1‚ was here
split_field.c:1952: warning: initialization makes integer from pointer without a cast
split_field.c:1952: warning: data definition has no type or storage class
split_field.c:1953: warning: type defaults to ‚int‚ in declaration of ‚ptr2‚
split_field.c:1953: error: redefinition of ‚ptr2‚
split_field.c:1896: error: previous definition of ‚ptr2‚ was here
split_field.c:1953: warning: initialization makes integer from pointer without a cast
split_field.c:1953: warning: data definition has no type or storage class
split_field.c:1955: error: syntax error before string constant
split_field.c:1955: warning: type defaults to ‚int‚ in declaration of ‚fprintf‚
split_field.c:1955: warning: data definition has no type or storage class
split_field.c:1957: error: syntax error before string constant
split_field.c:1957: warning: type defaults to ‚int‚ in declaration of ‚fprintf‚
split_field.c:1957: warning: data definition has no type or storage class
split_field.c:1974: error: syntax error before string constant
split_field.c:1974: warning: type defaults to ‚int‚ in declaration of ‚fprintf‚
split_field.c:1974: warning: data definition has no type or storage class
split_field.c:1976: error: syntax error before ‚[‚ token
split_field.c:1976: warning: type defaults to ‚int‚ in declaration of ‚munmap‚
split_field.c:1976: warning: data definition has no type or storage class
split_field.c:1977: error: syntax error before ‚.‚ token
split_field.c:1979: warning: type defaults to ‚int‚ in declaration of ‚munmap‚
split_field.c:1979: warning: parameter names (without types) in function declaration
split_field.c:1979: warning: data definition has no type or storage class
split_field.c:1980: warning: type defaults to ‚int‚ in declaration of ‚pUrn‚
split_field.c:1980: error: redefinition of ‚pUrn‚
split_field.c:1922: error: previous definition of ‚pUrn‚ was here
split_field.c:1980: warning: initialization makes integer from pointer without a cast
split_field.c:1980: warning: data definition has no type or storage class
split_field.c:1981: error: syntax error before ‚}‚ token
split_field.c:1994: error: syntax error before numeric constant
split_field.c:1994: warning: type defaults to ‚int‚ in declaration of ‚exit‚
split_field.c:1994: warning: data definition has no type or storage class
split_field.c:1998: error: syntax error before ‚[‚ token
split_field.c:1998: warning: type defaults to ‚int‚ in declaration of ‚check_space‚
split_field.c:1998: warning: data definition has no type or storage class
split_field.c:1999: error: syntax error before numeric constant
split_field.c:1999: warning: type defaults to ‚int‚ in declaration of ‚fwrite‚
split_field.c:1999: warning: data definition has no type or storage class
split_field.c:2002: warning: type defaults to ‚int‚ in declaration of ‚fclose‚
split_field.c:2002: warning: parameter names (without types) in function declaration
split_field.c:2002: warning: data definition has no type or storage class
split_field.c:2004: warning: type defaults to ‚int‚ in declaration of ‚ptr1‚
split_field.c:2004: error: redefinition of ‚ptr1‚
split_field.c:1952: error: previous definition of ‚ptr1‚ was here
split_field.c:2004: warning: initialization makes integer from pointer without a cast
split_field.c:2004: warning: data definition has no type or storage class
split_field.c:2005: warning: type defaults to ‚int‚ in declaration of ‚ptr2‚
split_field.c:2005: error: redefinition of ‚ptr2‚
split_field.c:1953: error: previous definition of ‚ptr2‚ was here
split_field.c:2005: warning: initialization makes integer from pointer without a cast
split_field.c:2005: warning: data definition has no type or storage class
split_field.c:2007: error: syntax error before string constant
split_field.c:2007: warning: type defaults to ‚int‚ in declaration of ‚fprintf‚
split_field.c:2007: warning: data definition has no type or storage class
split_field.c:2009: error: syntax error before string constant
split_field.c:2009: warning: type defaults to ‚int‚ in declaration of ‚fprintf‚
split_field.c:2009: warning: data definition has no type or storage class
split_field.c:2025: error: syntax error before string constant
split_field.c:2025: warning: type defaults to ‚int‚ in declaration of ‚fprintf‚
split_field.c:2025: warning: data definition has no type or storage class
split_field.c:2027: error: syntax error before ‚[‚ token
split_field.c:2027: warning: type defaults to ‚int‚ in declaration of ‚munmap‚
split_field.c:2027: warning: data definition has no type or storage class
split_field.c:2028: error: syntax error before ‚.‚ token
split_field.c:2030: warning: type defaults to ‚int‚ in declaration of ‚munmap‚
split_field.c:2030: warning: parameter names (without types) in function declaration
split_field.c:2030: warning: data definition has no type or storage class
split_field.c:2031: warning: type defaults to ‚int‚ in declaration of ‚pUrn‚
split_field.c:2031: error: redefinition of ‚pUrn‚
split_field.c:1980: error: previous definition of ‚pUrn‚ was here
split_field.c:2031: warning: initialization makes integer from pointer without a cast
split_field.c:2031: warning: data definition has no type or storage class
split_field.c:2032: error: syntax error before ‚}‚ token
split_field.c:2043: error: syntax error before numeric constant
split_field.c:2043: warning: type defaults to ‚int‚ in declaration of ‚exit‚
split_field.c:2043: warning: data definition has no type or storage class
split_field.c:2046: error: syntax error before ‚[‚ token
split_field.c:2046: warning: type defaults to ‚int‚ in declaration of ‚check_space‚
split_field.c:2046: warning: data definition has no type or storage class
split_field.c:2047: error: syntax error before numeric constant
split_field.c:2047: warning: type defaults to ‚int‚ in declaration of ‚fwrite‚
split_field.c:2047: warning: data definition has no type or storage class
split_field.c:2050: warning: type defaults to ‚int‚ in declaration of ‚fclose‚
split_field.c:2050: warning: parameter names (without types) in function declaration
split_field.c:2050: warning: data definition has no type or storage class
split_field.c:2052: warning: type defaults to ‚int‚ in declaration of ‚ptr1‚
split_field.c:2052: error: redefinition of ‚ptr1‚
split_field.c:2004: error: previous definition of ‚ptr1‚ was here
split_field.c:2052: warning: initialization makes integer from pointer without a cast
split_field.c:2052: warning: data definition has no type or storage class
split_field.c:2053: warning: type defaults to ‚int‚ in declaration of ‚ptr2‚
split_field.c:2053: error: redefinition of ‚ptr2‚
split_field.c:2005: error: previous definition of ‚ptr2‚ was here
split_field.c:2053: warning: initialization makes integer from pointer without a cast
split_field.c:2053: warning: data definition has no type or storage class
split_field.c:2055: error: syntax error before string constant
split_field.c:2055: warning: type defaults to ‚int‚ in declaration of ‚fprintf‚
split_field.c:2055: warning: data definition has no type or storage class
split_field.c:2057: error: syntax error before string constant
split_field.c:2057: warning: type defaults to ‚int‚ in declaration of ‚fprintf‚
split_field.c:2057: warning: data definition has no type or storage class
split_field.c:2073: error: syntax error before string constant
split_field.c:2073: warning: type defaults to ‚int‚ in declaration of ‚fprintf‚
split_field.c:2073: warning: data definition has no type or storage class
split_field.c:2075: error: syntax error before ‚[‚ token
split_field.c:2075: warning: type defaults to ‚int‚ in declaration of ‚munmap‚
split_field.c:2075: warning: data definition has no type or storage class
split_field.c:2076: error: syntax error before ‚.‚ token
split_field.c:2078: warning: type defaults to ‚int‚ in declaration of ‚munmap‚
split_field.c:2078: warning: parameter names (without types) in function declaration
split_field.c:2078: warning: data definition has no type or storage class
split_field.c:2079: warning: type defaults to ‚int‚ in declaration of ‚pUrn‚
split_field.c:2079: error: redefinition of ‚pUrn‚
split_field.c:2031: error: previous definition of ‚pUrn‚ was here
split_field.c:2079: warning: initialization makes integer from pointer without a cast
split_field.c:2079: warning: data definition has no type or storage class
split_field.c:2081: error: syntax error before ‚}‚ token
split_field.c:2083: error: syntax error before ‚[‚ token
split_field.c:2083: warning: type defaults to ‚int‚ in declaration of ‚strcpy‚
split_field.c:2083: warning: data definition has no type or storage class
split_field.c:2087: error: syntax error before ‚&‚ token
split_field.c:2087: warning: type defaults to ‚int‚ in declaration of ‚time‚
split_field.c:2087: error: conflicting types for ‚time‚
/usr/include/time.h:184: error: previous declaration of ‚time‚ was here
split_field.c:2087: warning: data definition has no type or storage class
split_field.c:2090: warning: type defaults to ‚int‚ in declaration of ‚get_time‚
split_field.c:2090: warning: parameter names (without types) in function declaration
split_field.c:2090: error: conflicting types for ‚get_time‚
general.h:60: error: previous declaration of ‚get_time‚ was here
split_field.c:2090: warning: data definition has no type or storage class
split_field.c:2092: error: syntax error before numeric constant
split_field.c:2092: warning: type defaults to ‚int‚ in declaration of ‚Print‚
split_field.c:2092: warning: data definition has no type or storage class
split_field.c:2094: error: syntax error before numeric constant
split_field.c:2094: warning: type defaults to ‚int‚ in declaration of ‚exit‚
split_field.c:2094: warning: data definition has no type or storage class

Can anyone help me, i am really stuck
 
Old 11-29-2006, 10:00 AM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,398
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
It is complaining about the source file 'split_field.c', on or around line 1807. Look at the source code, and see where the syntax error is, and fix it. If you are not a C programmer, post a fragment of the C file here (use CODE tags, please). About 10 lines before and after line 1807 should do it. Please indicate in your posting which line is 1807. There is a good chance that fixing one error clears up many others. I'm guessing, but it looks like there might be some kind of embedded assembler code, that would be Solaris/SPARC specific, and you might not be able to compile or run it on x86 hosted linux.

--- rod.
 
Old 11-29-2006, 10:31 AM   #3
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
The ‚ (a circumflex) characters that appear on your posting - is that how they appear in split_field.c? If so, it might be that the file has undergone some weird character set conversion. I don't think C likes these characters outside of a char string.
 
Old 12-01-2006, 04:09 AM   #4
sgriffiths
LQ Newbie
 
Registered: Nov 2006
Posts: 8

Original Poster
Rep: Reputation: 0
Here is the code, starting at line 1972

Code:
for (i=0; i < ValueInfo[t].total_urns; i++)
                        {   
							ptr3=ptr2;
                                        
                            memcpy(pc_binary, ptr3 + 3, 2);
                            memcpy(pc_binary + 1, ptr3 + 2, 2);
                            memcpy(pc_binary + 2, ptr3 + 1, 2);
                            memcpy(pc_binary + 3, ptr3, 2);
                            memcpy(ptr3, pc_binary, sizeof(unsigned int));
                            ptr3+=sizeof(unsigned int);

                            memcpy(pc_binary, ptr3 + 3, 2);
                            memcpy(pc_binary + 1, ptr3 + 2, 2);
                            memcpy(pc_binary + 2, ptr3 + 1, 2);
                            memcpy(pc_binary + 3, ptr3, 2);
                            memcpy(ptr3, pc_binary, sizeof(unsigned int));
                            ptr3+=sizeof(unsigned int);

                            memcpy(pc_binary, ptr3 + 3, 2);
                            memcpy(pc_binary + 1, ptr3 + 2, 2);
                            memcpy(pc_binary + 2, ptr3 + 1, 2);
                            memcpy(pc_binary + 3, ptr3, 2);
                            memcpy(ptr3, pc_binary, sizeof(unsigned int));

                            ptr2+=sizeof(unsigned int) + sizeof(unsigned int) + sizeof(unsigned int) + sizeof(unsigned int);

						}
 
Old 12-01-2006, 11:07 AM   #5
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,398
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
My own visual inspection of that code fragment reveals nothing, to me. However, if the code is from line 1972, as you say, it is outside the region where the first error was reported, and would seem to disagree with the context provided by the error messages. There is a message regarding line 1974 which makes reference to a string constant, of which the posted code contains none.

Having thought about your problem a little, one plausible explanation might be that you have redefined some kind of variable, perhaps through the use of a macro (which would suppress some kinds of errors or warnings). If the variable is part of a system header file, it would not ordinarily be noticed by you.

Perhaps you can break up your program into blocks that are syntactically correct, using #ifdefs / #endifs, and recompile until the messages go away. Then gradually include more and more of the code, until you have homed in on the offending section.

The error messages seem to refer to a lot of undefined types, which is typical when header files are not included, or not found. I don't know whether you posted the full text of the error messages, but if there is any message referring to unfound header files, it would go a long way to expalining your problem. Have you used any system calls that are inherently non-portable?

--- rod.

Last edited by theNbomr; 12-01-2006 at 11:12 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Problem compiling C++ file to Linux rigel_kent Programming 4 04-25-2006 07:40 AM
Moving files to Linux need help with problem MAVreix Linux - Software 1 04-20-2005 01:53 AM
Linux kernel compiling problem mmm Linux - General 4 08-07-2004 04:57 PM
copying/moving stalls when moving a lot of data to a usb stick =X•ģĶß= Linux - Hardware 10 07-30-2004 05:29 AM
Problem compiling util-linux buboleck Slackware 0 12-21-2003 06:41 AM

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

All times are GMT -5. The time now is 04:31 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration