473,326 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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_bsearchStringsI'
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_insensitive'
libsbml/src/.libs/libsbml.so: undefined reference to `c_locale_strtod'

Why system can not find these function ,they are system file
<stdlib.h<new<cmath>
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_AUTOMAKE(foreign)
AC_PROG_CC
AC_PROG_CXX
AM_PROG_LIBTOOL
AC_OUTPUT(Makefile 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_SOURCES = common/libsbml-version.cpp math/ASTNode.cpp math/
FormulaTokenizer.c util/List.cpp
AM_CPPFLAGS = -I../include -lsbml -lstdc++ -lm
Sep 27 '08 #1
2 6195
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<cmath>
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...@gmail.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<cmath>
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 misunderstanding 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
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...
6
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...
3
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
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...
4
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...
1
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 ...
8
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...
3
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...
3
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?. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.