Help with error

This is a discussion on Help with error within the C++ Programming forums, part of the General Programming Boards category; Hi everyone, I'm trying to compile this program on my mac and I get this error: Naix:examples Naix$ g++ -o ...

  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    52

    Help with error

    Hi everyone,

    I'm trying to compile this program on my mac and I get this error:

    Naix:examples Naix$ g++ -o prodcon prodcon.c
    prodcon.c:129:32: error: empty character constant
    prodcon.c: In function ‘void* producer(void*)’:

    This are the code snippets:

    129: while ( context->holder != '' ) {

    nvm by replacing those with ""
    Last edited by afflictedd2; 01-21-2010 at 07:33 PM.

  2. #2
    Registered User
    Join Date
    Jun 2005
    Posts
    6,208
    Code:
    while ( context->holder != '' )
    has two single quotes in sequence. You need to have something between them to represent a single character. The compiler is telling you off for leaving out whatever is needed between them (i.e. you need to have something between the quote characters, but you haven't. You have left it empty).

    For example 'A' represents uppercase A. '\'' (no double quotes here!) is a character that is a single quote.
    Right 98% of the time, and don't care about the other 3%.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. An error is driving me nuts!
    By ulillillia in forum C Programming
    Replies: 5
    Last Post: 04-04-2009, 09:15 PM
  3. Making C DLL using MSVC++ 2005
    By chico1st in forum C Programming
    Replies: 26
    Last Post: 05-28-2008, 01:17 PM
  4. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 09:33 AM
  5. Couple C questions :)
    By Divx in forum C Programming
    Replies: 5
    Last Post: 01-28-2003, 12:10 AM

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