Welcome to Linux Forums!

With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.

Linux Forum ArticlesLinux ForumsLinux Forum DownloadsLinux HostsFree MagazinesJobs
Home|Register|FAQ|Member List|Calendar|Unanswered Posts|Forum Rules|Today's Posts|Advanced Search|
SEARCH FOR IN
Go Back   Linux Forums > GNU Linux Zone > Linux Newbie
Reload this Page Bad GCC not recognizing NEWT
Linux Forums
Linux Forums
Welcome To The Linux Forums!
Welcome to Linux Forums. We pride ourselves in being one of the largest Linux communities on the web, we encourage you to REGISTER on our forums and participate in the community. There are over 150,000 members ready to answer your questions. JOINING US today will allow you to make new posts, get support, send messages to other members and submit downloads to our downloads directory and many other great features!

Linux Newbie If you're new to the wonderful world of Linux, start here!

Reply
 
Thread Tools Display Modes
Old 06-23-2008   #1 (permalink)
Just Joined!
 
Join Date: Jun 2008
Posts: 20
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.
arielby is offline   Reply With Quote
Old 06-23-2008   #2 (permalink)
Linux Engineer
 
Join Date: Nov 2007
Location: Córdoba (Spain)
Posts: 1,153
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.
i92guboj is offline   Reply With Quote
Old 06-23-2008   #3 (permalink)
Just Joined!
 
Join Date: Jun 2008
Posts: 20
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.
arielby is offline   Reply With Quote
Old 06-23-2008   #4 (permalink)
Linux Engineer
 
Join Date: Nov 2007
Location: Córdoba (Spain)
Posts: 1,153
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.
i92guboj is offline   Reply With Quote
Old 06-24-2008   #5 (permalink)
Just Joined!
 
Join Date: Jun 2008
Posts: 20
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.
arielby is offline   Reply With Quote
Old 06-24-2008   #6 (permalink)
Linux Engineer
 
Join Date: Nov 2007
Location: Córdoba (Spain)
Posts: 1,153
You need to add the library on command line:

Code:
gcc -o progname progname.c -lnewt
Try that
i92guboj is offline   Reply With Quote
Old 06-24-2008   #7 (permalink)
Just Joined!
 
Join Date: Jun 2008
Posts: 20
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?
arielby is offline   Reply With Quote
Old 06-24-2008   #8 (permalink)
Linux Engineer
 
Join Date: Nov 2007
Location: Córdoba (Spain)
Posts: 1,153
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.
i92guboj is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
 

Free Magazines
Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe
Systems Management News, the newspaper for IT systems administration and data center managers!
Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe
The Enterprise Newsweekly
eWeek is the essential technology information source for builders of e-business.
subscribe
Oracle Magazine
Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe
Total Telecom
Total Telecom is "The Economist of the communications industry".
subscribe
More free magazines »



All times are GMT. The time now is 07:58 AM.




© 2000 - 2008 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.2.0