473,545 Members | 1,989 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

undefined reference to "..."

Hello:

I execute make ,then get error:

$ make
Making all in libsbml/src
make[1]: Entering directory `/home/internet/mydoc/test_pj/libsbml/src'
........
/bin/sh ./libtool --tag=CC --mode=link gcc -g -O2 -o test test.o
libsbml/src/libsbml.la -lsbml -lstdc++ -lm
mkdir .libs
gcc -g -O2 -o .libs/test test.o libsbml/src/.libs/libsbml.so -lstdc++
-lm -Wl,--rpath -Wl,/usr/local/lib
libsbml/src/.libs/libsbml.so: undefined reference to `safe_strdup'
libsbml/src/.libs/libsbml.so: undefined reference to
`util_bsearchSt ringsI'
libsbml/src/.libs/libsbml.so: undefined reference to `safe_malloc'
libsbml/src/.libs/libsbml.so: undefined reference to `util_PosInf'
libsbml/src/.libs/libsbml.so: undefined reference to `util_isInf'
libsbml/src/.libs/libsbml.so: undefined reference to `util_NaN'
libsbml/src/.libs/libsbml.so: undefined reference to `safe_calloc'
libsbml/src/.libs/libsbml.so: undefined reference to
`strcmp_insensi tive'
libsbml/src/.libs/libsbml.so: undefined reference to `c_locale_strto d'

Why system can not find these function ,they are system file
<stdlib.h<new<c math>
which has been included in my app.c.
What should I do?
Eager to receive your reply!

my configure.in file:

AC_INIT(main, 0.1, zq*******@gmail .com)
AM_INIT_AUTOMAK E(foreign)
AC_PROG_CC
AC_PROG_CXX
AM_PROG_LIBTOOL
AC_OUTPUT(Makef ile libsbml/src/Makefile)

my Makefile.am file:

bin_PROGRAMS = test
SUBDIRS = libsbml/src .
test_SOURCES = test.c

test_LDADD = libsbml/src/libsbml.la -lsbml -lstdc++ -lm

AM_CPPFLAGS = -Ilibsbml/include

my libsbml/src/Makefile.am

AUTOMAKE_OPTS = gnu
lib_LTLIBRARIES = libsbml.la
libsbml_la_SOUR CES = common/libsbml-version.cpp math/ASTNode.cpp math/
FormulaTokenize r.c util/List.cpp
AM_CPPFLAGS = -I../include -lsbml -lstdc++ -lm
Sep 27 '08 #1
2 6215
zqiang320 wrote:
Hello:

I execute make ,then get error:

$ make
Making all in libsbml/src
make[1]: Entering directory `/home/internet/mydoc/test_pj/libsbml/src'
........
/bin/sh ./libtool --tag=CC --mode=link gcc -g -O2 -o test test.o
libsbml/src/libsbml.la -lsbml -lstdc++ -lm
mkdir .libs
>
Why system can not find these function ,they are system file
<stdlib.h<new<c math>
which has been included in my app.c.
You are building something as C++ and this is a C group. If you should
be building as C, fix things so you do, if you are building C++ code,
try a platform or gnu list where you will get better help. Tool
problems are as off topic on c.l.c++ as they are here.

--
Ian Collins.
Sep 27 '08 #2
On 27 Sep, 04:08, zqiang320 <zqiang...@gmai l.comwrote:
I execute make ,then get error:
<snip>
libsbml/src/.libs/libsbml.so: undefined reference to `safe_strdup'
<snip>
>
Why system can not find these function ,they are system file
<stdlib.h<new<c math>
which has been included in my app.c.
What should I do?
Your questions are not about the C language, and you will
get better answers if you ask elsewhere. However, this
question indicates a fundamental misunderstandin g about
header files and libraries. If a function is declared
in the header and you include that header, then the
compiler has a declaration of the function, but
the linker does not necessarily have a definition
of the function. Consider this example:

/* BROKEN CODE */
extern int foo( int );
int main( void )
{
return foo( 5 );
}

Would you expect this to build? Chances are good you'll
get an error something like:

Undefined symbols:
"_foo", referenced from:
_main in cc46tCIn.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

The situation is the same if foo is declared in foo.h and
you write:
#include <foo.h>
int main( void ) { return foo(); }

Declarations appearing in the header files have (almost)
absolutely nothing to do with the error you are seeing.
Sep 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
7754
by: Steven T. Hatton | last post by:
Scroll to the bottom and read the last part first. I've been trying very diligently to 'modularize' the code from TC++PL3E found here: http://www.research.att.com/~bs/matrix.c I keep getting what I believe are linker errors. For example: g++ -g -O2 -o rematrix cslice_iter.o main.o matrix.o rematrix.o slice_iter.o...
6
6228
by: mihailsmilev | last post by:
Hello, let me first describe the situation: I am developing an application using Qt Designer 3.3.5 on OpenSuSE Linux for my mp3 player. So I need to get the id3 tags from the mp3 files, and I've downloaded the sources of id3lib. I've included the headers (there are no other files) in my project in Qt designer, then created an object from my...
3
2040
by: s.z.s | last post by:
Hi! I hope the solution to that is not too stupid... I've got three files: <snip test_main.cc> #include"test.hh" int main(void) { A<inta1; a1.saywhat();
8
1933
by: Soneji | last post by:
Hello all! ( again ) Once more, I have a problem that seems unsolvable by me. I'm getting the, seemingly common, "undefined reference" linking error. I've tried quite a few things, but nothing is working. I'll list what I've tried at the end of my post. Until then, here's the error message, and the code ( Sorry...( length ) ) :
4
1693
by: steve | last post by:
Hi, I am trying to compile a sample program using gcc. The program requires headers so I put the header files and corresponding source files into one folder. Then I ran the command 'gcc prog.c -o prog.exe.' It then gives me errors such as "undefined reference to '_N_VNew'" where N_VNew is in the header files I put in the folder. Usually gcc...
1
2125
by: ashjas | last post by:
Hello, i am trying to compile a code(main.cpp) which uses a function that is declared in a header file that is within the directory where the main.cpp file resides so the header is included as #include"abc.h" that function's definition is inside abc.cpp that also resides in the directory of main.cpp i.e with abc.h but still on usage of...
8
6277
Motoma
by: Motoma | last post by:
Good evening everyone. I am starting to re-explore C++, and I wanted to build a singleton class. Unfortunately, when I set things up as I do in PHP, it doesn't work out for me. I hope that the problem is something small and obvious, but here is what I have: #include <iostream> using namespace std; class ClientManager {
3
4303
by: tvnaidu | last post by:
I am doing small c prog using math, I wanted to square a value, when I do "sq((float)val1)", I am getting undefined reference. also I am using 'sqrt', I am able to pass compile for that by passing "-lm" and include "math.h", how to fix 'sq' issue?. thanks.
3
35611
by: tvnaidu | last post by:
I compiled tinyxml files (.cpp files) and when I am linking to create final exe in Linux, I am getting lot of errors saying "undefiend reference" to "operator new" and "delete", any idea?. Main.cpp:377: undefined reference to `operator delete(void*)' tinyXML/include/tinystr.h:259: undefined reference to `operator delete(void*)'...
0
7487
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7680
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7934
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7778
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6003
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3476
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3459
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1033
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
731
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.