Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-02-2011, 01:47 AM   #1
LQ Newbie
Registered: Apr 2010
Location: hangzhou, china
Distribution: Fedora 13
Posts: 9

Rep: Reputation: 0
Angry Why GCC compiling went wrong? One step is btter than two steps?

Hi, when I was trying to compile a program to validate a SCEW lib, GCC prompted some strange errors... Could anyone pls give a quick shot? Thanks!

Compling&Linking in one command is OK, but after I separated it into two command it went wrong,,,

[root@fileserver2 common]# gcc scew_print.c -L ./scew -lscew -lexpat -I ./scew -o kkk
[root@fileserver2 common]# ./kkk
Usage: scew_print file.xml
[root@fileserver2 common]# gcc -I ./scew -c scew_print.c
[root@fileserver2 common]# gcc -L ./scew -lscew -lexpat -I ./scew -o kkk scew_print.o
scew_print.o: In function `print_attributes':
scew_print.c.text+0x43): undefined reference to `scew_element_attributes'
scew_print.c.text+0x53): undefined reference to `scew_list_data'
scew_print.c.text+0x61): undefined reference to `scew_attribute_value'
scew_print.c.text+0x6e): undefined reference to `scew_attribute_name'
scew_print.c.text+0x8d): undefined reference to `scew_list_next'
(rest of erro msg were deleted...)

PS: libscew.a is compiled by " ar -rc libscew.a $(OBJS)"...

Last edited by nwpuhlh; 04-02-2011 at 01:51 AM.
Old 04-02-2011, 02:00 AM   #2
LQ Newbie
Registered: Apr 2010
Location: hangzhou, china
Distribution: Fedora 13
Posts: 9

Original Poster
Rep: Reputation: 0
Question After change the parameters order, it works! why?

I just changed the order of parameters it works! Why?

[root@fileserver2 common]# gcc -o kkk scew_print.o -L ./scew -lscew -lexpat -I ./scew
[root@fileserver2 common]# ./kkk
Usage: scew_print file.xml


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: EC Takes One Step Forward, Two Steps Back in Openness LXer Syndicated Linux News 0 12-21-2010 07:10 PM
gcc looking in wrong directory for while compiling xorg-server-1.1.1 Wunderbred Linux - Software 10 03-18-2010 12:14 PM
error 396, on a variable (gcc), learning GCC step by step frenchn00b Programming 2 09-11-2009 02:03 PM
Does anyone have a good step by step on compiling a Kernel? Kramer Linux - Hardware 5 10-06-2003 06:51 PM
one step ahead...two steps backwards dbear Linux - Newbie 1 07-07-2003 06:42 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:04 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration