Thread: cchar compiler error.

  1. #1
    Registered User
    Join Date
    Mar 2011
    Location
    Stockholm, Sweden
    Posts
    20

    cchar compiler error.

    for this func mvin_wch, which in the manual looks like this.

    int mvin_wch(int y, int x, cchar_t *wcval);

    This make me expect that I should have a varable of type cchar_t

    But when I try - just for a test, write a very simple app to create a variable of cchar_t

    Code:
    #include <stdio.h>
    #include <curses.h>
    
    int main(void)
    {
        cchar_t ccht;
     return 0;
    }
    And then compile: gcc -lncursesw -g test.c -o test -Wall
    I got compiler error 'cchar_t undeclared'

    mvin_wch is in ncurses, and therefore I expect that cchar_t should be supported when including the curses header file,

    What am I doing wrong.?
    I should not need to use intscr() and endwin() just for this test.?
    Last edited by #define whatevr; 04-18-2011 at 05:20 AM.

  2. #2
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Is the location of curses.h in your standard INCLUDE path?

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Looking at the header file here, it seems that cchar_t is a conditional compilation option.

    This worked here
    gcc -D_XOPEN_SOURCE_EXTENDED bar.c

    See also Feature Test Macros - The GNU C Library
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Mar 2011
    Location
    Stockholm, Sweden
    Posts
    20
    Quote Originally Posted by rags_to_riches View Post
    Is the location of curses.h in your standard INCLUDE path?
    Yes it is, I am building an viewer based on curses - and I recompile it a lot of times every day, so I am sure it is.

  5. #5
    Registered User
    Join Date
    Mar 2011
    Location
    Stockholm, Sweden
    Posts
    20
    Quote Originally Posted by Salem View Post
    Looking at the header file here, it seems that cchar_t is a conditional compilation option.

    This worked here
    gcc -D_XOPEN_SOURCE_EXTENDED bar.c

    See also Feature Test Macros - The GNU C Library
    Doesn't work to me. Can I kindley ask you to see what happens if you use the same e switches as I posted that I do.?

  6. #6
    Registered User
    Join Date
    Mar 2011
    Location
    Stockholm, Sweden
    Posts
    20
    Quote Originally Posted by Salem View Post
    Looking at the header file here, it seems that cchar_t is a conditional compilation option.

    This worked here
    gcc -D_XOPEN_SOURCE_EXTENDED bar.c

    See also Feature Test Macros - The GNU C Library
    I Misspelled the switch to the compiler, I retried - and as compile switch it works well, and also as #define in top of the file.

    Thank you for the help.

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    I get the expected error: ‘cchar_t’ undeclared (first use in this function)
    Expected, because the only option of note is a linker option (for the library), not a compiler/pre-processor option.

    If it "didn't work for you", all I can suggest is you read your curses.h header file, and see how cchar_t is declared.
    Like for me, it is protected by a conditional compilation flag.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  8. #8
    Registered User
    Join Date
    Mar 2011
    Location
    Stockholm, Sweden
    Posts
    20
    Did you see my post above.? I solved it with the info you gave me, thank you.
    Last edited by #define whatevr; 04-18-2011 at 05:18 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 12-13-2010, 10:02 PM
  2. GCC compiler giving syntax error before 'double' error
    By dragonmint in forum Linux Programming
    Replies: 4
    Last Post: 06-02-2007, 05:38 PM
  3. Compiler error error C2065: '_beginthreadex; : undeclared identifier
    By Roaring_Tiger in forum Windows Programming
    Replies: 3
    Last Post: 04-29-2003, 01:54 AM
  4. Compiler error or human error?
    By skyruler54 in forum C++ Programming
    Replies: 6
    Last Post: 09-06-2002, 02:27 PM
  5. fatal error C1001: INTERNAL COMPILER ERROR
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 04-21-2002, 12:07 PM