Find the answer to your Linux question:
Results 1 to 8 of 8
Posts: 12 GCC bug? My GCC does not recognize newt.h. He does not give me the missing Include (hw.c:2:20: error: studio.h: No such file or directory) error, but the unfound ...
  1. #1
    Just Joined!
    Join Date
    Jun 2008
    Posts
    34

    Bad GCC not recognizing NEWT

    Posts: 12
    GCC bug?
    My GCC does not recognize newt.h.
    He does not give me the missing Include (hw.c:2:20: error: studio.h: No such file or directory) error, but the unfound method error (
    /tmp/ccAdUhKq.o: In function `main':
    hw.c.text+0x19): undefined reference to `print'
    collect2: ld returned 1 exit status).
    I using the lastest newt-dev from APT and GCC 4.1.2 20061115 on Debian 4.1.1-21.

  2. #2
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by arielby View Post
    Posts: 12
    GCC bug?
    My GCC does not recognize newt.h.
    He does not give me the missing Include (hw.c:2:20: error: studio.h: No such file or directory) error, but the unfound method error (
    /tmp/ccAdUhKq.o: In function `main':
    hw.c.text+0x19): undefined reference to `print'
    collect2: ld returned 1 exit status).
    I using the lastest newt-dev from APT and GCC 4.1.2 20061115 on Debian 4.1.1-21.
    I hope that "studio.h" and "print" are typos. If not, you should change them by "stdio.h" and "printf" probably (I can't tell you any other thing without having seen your source code...)

    In any case, newt probably is a separate package, so, you might need to install it separately, along with any -dev or -devel matching package.

  3. #3
    Just Joined!
    Join Date
    Jun 2008
    Posts
    34
    Quote Originally Posted by i92guboj View Post
    I hope that "studio.h" and "print" are typos. If not, you should change them by "stdio.h" and "printf" probably (I can't tell you any other thing without having seen your source code...)

    In any case, newt probably is a separate package, so, you might need to install it separately, along with any -dev or -devel matching package.
    studio.h and print are like foo/bar, to show you what type of error i got, not missing(/mistyped) header (like writing studio.h instead of stdio.h) but a missing/mistyped method (like print instead of printf). When i started learning C, i mistaken stdio to studio (didn't now it stands for STanDard Input/Output), but now i don't.

    I installed newt-dev via apt (apt-get install libnewt-dev) beforehand, and, as you should know, the .h files are in the dev, and i didn't got a missing header error, but a missing method one.

  4. #4
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by arielby View Post
    studio.h and print are like foo/bar, to show you what type of error i got, not missing(/mistyped) header (like writing studio.h instead of stdio.h) but a missing/mistyped method (like print instead of printf). When i started learning C, i mistaken stdio to studio (didn't now it stands for STanDard Input/Output), but now i don't.

    I installed newt-dev via apt (apt-get install libnewt-dev) beforehand, and, as you should know, the .h files are in the dev, and i didn't got a missing header error, but a missing method one.
    Hi again,

    You confirmed that you installed the dev package, but did you install the binary library as well?

    Try to post the exact error messages, it's hard to guess whether newt has actually something to do with your problem or if something is being overlooked. Having the source to look at, the command line you used and the exact errors would ease the thing.

    Cheers.

  5. #5
    Just Joined!
    Join Date
    Jun 2008
    Posts
    34
    Quote Originally Posted by i92guboj View Post
    Hi again,

    You confirmed that you installed the dev package, but did you install the binary library as well?

    Try to post the exact error messages, it's hard to guess whether newt has actually something to do with your problem or if something is being overlooked. Having the source to look at, the command line you used and the exact errors would ease the thing.

    Cheers.
    The binary package is installed.

    "Console Dump":
    Code:
    ariel@artwaresoft-linux:~$ gcc newthw.c
    /tmp/ccCdHkm2.o: In function `main':
    newthw.c:(.text+0x12): undefined reference to `newtInit'
    newthw.c:(.text+0x17): undefined reference to `newtCls'
    newthw.c:(.text+0x33): undefined reference to `newtDrawRootText'
    newthw.c:(.text+0x4f): undefined reference to `newtDrawRootText'
    newthw.c:(.text+0x5b): undefined reference to `newtPushHelpLine'
    newthw.c:(.text+0x60): undefined reference to `newtRefresh'
    newthw.c:(.text+0x78): undefined reference to `newtPushHelpLine'
    newthw.c:(.text+0x7d): undefined reference to `newtRefresh'
    newthw.c:(.text+0x8e): undefined reference to `newtPopHelpLine'
    newthw.c:(.text+0x93): undefined reference to `newtRefresh'
    newthw.c:(.text+0xa4): undefined reference to `newtFinished'
    collect2: ld returned 1 exit status
    Source:
    Code:
    #include <newt.h>
    #include <stdlib.h>
    
    int main(void) {
        newtInit();
        newtCls();
    
        newtDrawRootText(0, 0, "Some root text");
        newtDrawRootText(-25, -2, "Root text in the other corner");
    
        newtPushHelpLine(NULL);
        newtRefresh();
        sleep(1);
    
        newtPushHelpLine("A help line");
        newtRefresh();
        sleep(1);
    
        newtPopHelpLine();
        newtRefresh();
        sleep(1);
        newtFinished();
    }
    Hello World programs work.

  6. #6
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    You need to add the library on command line:

    Code:
    gcc -o progname progname.c -lnewt
    Try that

  7. #7
    Just Joined!
    Join Date
    Jun 2008
    Posts
    34
    Quote Originally Posted by i92guboj View Post
    You need to add the library on command line:

    Code:
    gcc -o progname progname.c -lnewt
    Try that
    When progname is?

  8. #8
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by arielby View Post
    When progname is?
    The name of your source file. In your example "newthw.c".

    -o indicates the name of the resulting file, you can name it whatever you want.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...