Thread: gcc compile problem

  1. #1
    Registered User
    Join Date
    May 2003

    gcc compile problem

    I am having problems compiling code, I am using gcc --version 3.2.2-3mdk, using the command gcc -D_GNU_SOURCE test.c -o test. Following is the well renound ´hello world´ intro prog which i am using as a test to try and find where the problem is. Following the code is the output i recevie on the console.

    #include <stdio.h>
    int main(int argc, char **argv) {
    	(void) argc;
    	(void) argv;
    	printf(¨hello world!\n¨);
    	return 0;
    test.c: In function `main':
    test.c:8: stray '\250' in program
    test.c:8: `hello' undeclared (first use in this function)
    test.c:8: (Each undeclared identifier is reported only once
    test.c:8: for each function it appears in.)
    test.c:8: parse error before "world"
    test.c:8: stray '\' in program
    test.c:8: stray '\250' in program

    This has got me stumped as it is happening for all code I try to compile, non of which is very advanced as i am relativly a newb. (btw: this used to work in an older version i had of gcc)

    Any help would be greatly appreciated.


  2. #2
    Registered User
    Join Date
    May 2003
    Thanks for that but im not sure itś quite right, I just typed that up myself before using ¨kwrite¨ which is really just like notepad. I likewise noticed the funny ¨ ¨ but that is just how they come up when I type it on the keyboard. I am currently using mdk 9.1, and am thinking of going back to mdk 8.2 because there using the same combination of kwrite, ¨ ¨ ś and the older gcc it worked. But if you have any further ideas please let me know. Also thanks again for the reply.

    btw: just tryed using both emacs and vi and everyother text editor I have and i get exactly the same error message (I retype the code everytime, not copy/paste)

    Last edited by keyz; 05-22-2003 at 06:42 AM.

  3. #3
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Ontario, Canada
    Yeah, its definitely a problem with the double quotes.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  4. #4
    Registered User
    Join Date
    May 2003
    Thank's to both of your input I have found the solution! The problem did lie with the dodgy "" I had before. To ammend this I changed the keyboard layout settings to US international keyboard. So if anyone else is as silly as me and has the same problem check your keyboard layout settings!

    And I will keep that in mind if a similar problem every arises again Salem.

    Btw: kwrite is a great little text editor for doing c and many other languages in and it has no problems once you have good "". Should probaly give it a go, if your interested.

    Thank's again!


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem with gcc
    By jayee_spicyguy in forum Linux Programming
    Replies: 8
    Last Post: 10-21-2008, 08:12 AM
  2. Problem using map<> - Compile Errors
    By intruder in forum C++ Programming
    Replies: 15
    Last Post: 04-19-2006, 11:56 AM
  3. Weird (!) gcc (g++) compile error
    By Skarr in forum C++ Programming
    Replies: 3
    Last Post: 08-21-2002, 05:09 PM
  4. C++ compile problem
    By Rhuantavan in forum C++ Programming
    Replies: 3
    Last Post: 06-15-2002, 03:29 PM
  5. GCC compile error coz of file pointer
    By Shadow in forum C Programming
    Replies: 5
    Last Post: 04-20-2002, 12:50 PM