Help with an error message

This is a discussion on Help with an error message within the C Programming forums, part of the General Programming Boards category; Hi I have a trouble with an error message that appear for my code The message is: In function ‘reverse’: ...

  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    6

    Unhappy Help with an error message

    Hi
    I have a trouble with an error message that appear for my code
    The message is:
    In function ‘reverse’:
    myfile.c:34: warning: large fixed-point constant implicitly truncated to fixed-point type
    myfile.c:34: error: fixed-point types not supported for this target
    the only i'm trying to do is:

    Code:
    {       
            int p,y;
    	int r=0;
    	x=(x<0)?-x:x;
    	while (p>=0)
    	{
    		y = x % 10;
    		p = x/10;
    		r = 10r + y;   //THIS IS THE LINE 34!
    		x = p;
    		printf("%d",r);
    	}
    	return 0;
    }

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    I didn't even know "10r" was valid C. I imagine you meant "10*r".

  3. #3
    Registered User
    Join Date
    Jan 2010
    Posts
    412
    Are you trying to multiply by 10? If so then it should be
    r = 10 * r + y;

  4. #4
    Registered User
    Join Date
    Mar 2010
    Posts
    6
    oops yea!
    ohh my godness! I didnt notice that! bfffff
    I;m really sorry! I feel like an idiot

  5. #5
    Registered User
    Join Date
    Mar 2010
    Posts
    6
    bfff can u please help me for another thing? :/
    Im trying to put a file.txt as an input to my programme with Redirection technique
    but when Im writing in the terminal:
    myprogramme<myfile.txt
    I get this message:
    myprogramme: command not found
    Why am i getting this message?

  6. #6
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Quote Originally Posted by Fricky View Post
    bfff can u please help me for another thing? :/
    Im trying to put a file.txt as an input to my programme with Redirection technique
    but when Im writing in the terminal:
    myprogramme<myfile.txt
    I get this message:
    myprogramme: command not found
    Why am i getting this message?
    Your current directory may not be in your path (it often isn't in unix-y systems). You would then have to type "./myprogramme". (This assumes that you have successfully compiled your program, and it isn't called "a.out".)

  7. #7
    Registered User
    Join Date
    Mar 2010
    Posts
    6
    Yea.It successfully compiled ,no is not named "a.out" it's named "myprogramme".
    And its also on the same path with the txt!I have checked it with "ls" command.
    Any ideas?
    Last edited by Fricky; 03-17-2010 at 01:37 PM.

  8. #8
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Quote Originally Posted by Fricky View Post
    Yea.It successfully compiled ,no is not named "a.out" it's named "myprogramme"
    And its also on the same path!I have checked it with "ls" command
    ls doesn't check your path, it just tells you what files are in your current/specified directory. You can check your path with something like "$PATH".

  9. #9
    Registered User
    Join Date
    Mar 2010
    Posts
    6
    with "$PATH" i get this one:
    "$PATH".
    bash: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games.: No such file or directory
    maybe i understood wrong.

  10. #10
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    The period was just the end of the sentence. But the bottom is the path: those seven directories are where the system will look for an executable file. None of them is your current directory, so to execute your program you will need to give the full (-ish) path. So type
    Code:
    ./myprogramme < myfile.txt
    so your system knows what directory to look in.

  11. #11
    Registered User
    Join Date
    Mar 2010
    Posts
    6
    ok i fixed it! Thanx!

    EDIT:
    what does this warning mean?
    gcc -o reverse reverse.c
    /usr/lib/gcc/x86_64-linux-gnu/4.4.1/../../../../lib/crt1.o: In function `_start':
    /build/buildd/eglibc-2.10.1/csu/../sysdeps/x86_64/elf/start.S:109: undefined reference to `main'
    collect2: ld returned 1 exit status
    Thanx in advance,and sorry for the many questions!

  12. #12
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    That means you need to have a function called "main" in your program, because that's the function that is automatically called by the system when you run your program.

Popular pages Recent additions subscribe to a feed

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21