 |
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. |
| |
06-23-2008
|
#2 (permalink)
| | Linux Engineer
Join Date: Nov 2007 Location: Córdoba (Spain)
Posts: 1,158
| Quote:
Originally Posted by arielby 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. |
| |
06-23-2008
|
#3 (permalink)
| | Just Joined!
Join Date: Jun 2008
Posts: 20
| Quote:
Originally Posted by i92guboj 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. |
| |
06-23-2008
|
#4 (permalink)
| | Linux Engineer
Join Date: Nov 2007 Location: Córdoba (Spain)
Posts: 1,158
| Quote:
Originally Posted by arielby 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. |
| |
06-24-2008
|
#5 (permalink)
| | Just Joined!
Join Date: Jun 2008
Posts: 20
| Quote:
Originally Posted by i92guboj 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. |
| |
06-24-2008
|
#6 (permalink)
| | Linux Engineer
Join Date: Nov 2007 Location: Córdoba (Spain)
Posts: 1,158
| You need to add the library on command line: Code: gcc -o progname progname.c -lnewt
Try that  |
| |
06-24-2008
|
#7 (permalink)
| | Just Joined!
Join Date: Jun 2008
Posts: 20
| Quote:
Originally Posted by i92guboj You need to add the library on command line: Code: gcc -o progname progname.c -lnewt
Try that  | When progname is? |
| |
06-24-2008
|
#8 (permalink)
| | Linux Engineer
Join Date: Nov 2007 Location: Córdoba (Spain)
Posts: 1,158
| Quote:
Originally Posted by arielby 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. |
| | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is 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 02:10 AM. |
| |