LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Problem compiling after moving to Linux (https://www.linuxquestions.org/questions/linux-software-2/problem-compiling-after-moving-to-linux-505847/)

sgriffiths 11-29-2006 05:13 AM

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

theNbomr 11-29-2006 10:00 AM

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.

matthewg42 11-29-2006 10:31 AM

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.

sgriffiths 12-01-2006 04:09 AM

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);

                                                }


theNbomr 12-01-2006 11:07 AM

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.


All times are GMT -5. The time now is 02:30 AM.