473,387 Members | 1,890 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,387 software developers and data experts.

C/C++ link problems

Hi all,

Please help me...

I have two projects: systemc (written in C++) and x264 (written in C).
I would like to have a C++ project that that can call both systemc
functions and x264 functions. What I've done is I've linked both
libraries into my project, using an additional header file to include
the C functions from x264 as follows:

#ifndef __x264__h__
#define __x264__h__

extern "C" {

#include "../x264/...";

// include all the x264 headers here.

}

The project seems to compile fine, however when it gets to the linking
stage it complains that it can't find a bunch of functions. What I'm
having difficulty with is the fact that I'm using g++ (and explicitly
linking in the stdc++ library) and the functions it can't find all
relate to C++ functions, either in the standard library or in systemc.
Previous usenet posts suggest that I may be using gcc opposed to g++,
but, as my log shows, I am using the correct compiler. Even odder is
the fact that it doesn't report that it can't find the x264 C
functions I use (at least to my knowledge).

When I run make I get (just a bit of the output):

In file included from algorithm/x264/core/common.h:35,
from algorithm/x264.h:15,
from arch/src/camera.h:10,
from arch/src/camg++ -Wno-deprecated -g -Wall -I.
-I.. -I./algorithm -I./algorithm/core -I./algorithm/encoder In file
included from algorithm/x264/core/common.h:35,
from alg++ -Wno-deprecated -g -Wall -I. -I..
-I./algorithm -I./algorithm/core -I./algorithm/encoder -Isystemc
-I../common/systemc/include -L. -L.. -L../common/systemc/lib-linux
-L./algorithm/x26../common/systemc/lib-linux/libsystemc.a(sc_main.o):
In function `_GLOBAL__I_sc_in_action':
sc_main.o(.text+0xc): undefined reference to
`std::ios_base::Init::Init[in-charge]()'
.../common/systemc/lib-linux/libsystemc.a(sc_main.o): In function
`main':
sc_main.o(.text+0x8b): undefined reference to `__cxa_begin_catch'
sc_main.o(.text+0x92): undefined reference to
`std::basic_ostream<char, std::char_traits<char> >& std::endl<char,
std::char_traits<char> >(std::basic_ostream<char,
std::char_traits<char> >&)'
sc_main.o(.text+0xa7): undefined reference to `std::cout'
sc_main.o(.text+0xac): undefined reference to
`std::basic_ostream<char, std::char_traits<char> >& std::operator<<
<std::char_traits<char> >(std::basic_ostream<char,
std::char_traits<char> >&, char const*)'
sc_main.o(.text+0xb5): undefined reference to
`std::basic_ostream<char, std::char_traits<char> >& std::operator<<
<std::char_traits<char> >(std::basic_ostream<char,
std::char_traits<char> >&, char const*)'
sc_main.o(.text+0xbe): undefined reference to
`std::basic_ostream<char, std::char_traits<char>
::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))'
sc_main.o(.text+0xc6): undefined reference to `__cxa_end_catch'
sc_main.o(.text+0xd5): undefined reference to `__cxa_begin_catch'
sc_main.o(.text+0xe4): undefined reference to
`std::basic_ostream<char, std::char_traits<char> >& std::endl<char,
std::char_traits<char> >(std::basic_ostream<char,
std::char_traits<char> >&)'
sc_main.o(.text+0xf5): undefined reference to `std::cout'
sc_main.o(.text+0xfa): undefined reference to
`std::basic_ostream<char, std::char_traits<char> >& std::operator<<
<std::char_traits<char> >(std::basic_ostream<char,
std::char_traits<char> >&, char const*)'
sc_main.o(.text+0x103): undefined reference to
`std::basic_ostream<char, std::char_traits<char> >& std::operator<<
<std::char_traits<char> >(std::basic_ostream<char,
std::char_traits<char> >&, char const*)'
sc_main.o(.text+0x10c): undefined reference to
`std::basic_ostream<char, std::char_traits<char>::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))'
sc_main.o(.text+0x117): undefined reference to `__cxa_begin_catch'
sc_main.o(.text+0x11e): undefined reference to
`std::basic_ostream<char, std::char_traits<char> >& std::endl<char,
std::char_traits<char> >(std::basic_ostream<char,
std::char_traits<char> >&)'
sc_main.o(.text+0x12f): undefined reference to `std::cout'
sc_main.o(.text+0x134): undefined reference to
`std::basic_ostream<char, std::char_traits<char> >& std::operator<<
<std::char_traits<char> >(std::basic_ostream<char,
std::char_traits<char> >&, char const*)'
sc_main.o(.text+0x13d): undefined reference to
`std::basic_ostream<char, std::char_traits<char> >& std::operator<<
<std::char_traits<char> >(std::basic_ostream<char,
std::char_traits<char> >&, char const*)'
sc_main.o(.text+0x146): undefined reference to
`std::basic_ostream<char, std::char_traits<char>::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))'
sc_main.o(.text+0x153): undefined reference to `__cxa_end_catch'
sc_main.o(.text+0x15c): undefined reference to `_Unwind_Resume'
.../common/systemc/lib-linux/libsystemc.a(sc_main.o): In function
`__tcf_0':
sc_main.o(.text+0x3c): undefined reference to
`std::ios_base::Init::~Init [in-charge]()'
.../common/systemc/lib-linux/libsystemc.a(sc_main.o)(.gcc_except_table+0x2c):
undefined reference to `typeinfo for char const*'
.../common/systemc/lib-linux/libsystemc.a(sc_main.o)(.eh_frame+0x12):
undefined reference to `__gxx_personality_v0'
.../common/systemc/lib-linux/libsystemc.a(sc_simcontext.): In function
`_GLOBAL__I__ZN16sc_process_tableC2Ev':
sc_simcontext.(.text+0x19c): undefined reference to
`std::ios_base::Init::Init[in-charge]()'
.../common/systemc/lib-linux/libsystemc.a(sc_simcontext.): In function
`sc_simcontext::crunch()':
sc_simcontext.(.text+0x669): undefined reference to `_Unwind_Resume'
sc_simcontext.(.text+0x69f): undefined reference to
`__cxa_begin_catch'
sc_simcontext.(.text+0x6a6): undefined reference to
`std::basic_ostream<char, std::char_traits<char> >& std::endl<char,
std::char_traits<char> >(std::basic_ostream<char,
std::char_traits<char> >&)'
sc_simcontext.(.text+0x6bf): undefined reference to `std::cout'
sc_simcontext.(.text+0x6c4): undefined reference to
`std::basic_ostream<char, std::char_traits<char> >& std::operator<<
<std::char_traits<char> >(std::basic_ostream<char,
std::char_traits<char> >&, char const*)'
sc_simcontext.(.text+0x6cd): undefined reference to
`std::basic_ostream<char, std::char_traits<char> >& std::operator<<
<std::char_traits<char> >(std::basic_ostream<char,
std::char_traits<char> >&, char const*)'
sc_simcontext.(.text+0x6d6): undefined reference to
`std::basic_ostream<char, std::char_traits<char>::operator<<(std::basic_ostream<char, std::char_traits<char> >&

(*)(std::basic_ostream<char, std::char_traits<char> >&))'
sc_simcontext.(.text+0x6e2): undefined reference to `__cxa_end_catch'
Thanks for your help.

Stephen
Jul 22 '05 #1
2 3362
stephen henry wrote:
[...]


<offtopic>
Link errors, especially "unresolved externals" or "undefined
references", are almost always due to the fact that some
library file is missing from the list of libraries supplied
to the linker. As I encountered recently, UNIX linkers are
single-pass, so, if you have two libraries referring to each
other, you need to mention those libraries twice. Make sure
you have all necessary libraries mentioned and in the right
order.
</offtopic>

Link errors have very little to do with the language. Please
post your further inquiries to a newsgroup that deals with
your compiler. gnu.g++.help seems right.

V
Jul 22 '05 #2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stephen,

Could you tell us what your link line looked like?

Evan

stephen henry wrote:
Hi all,

Please help me...

I have two projects: systemc (written in C++) and x264 (written in C).
I would like to have a C++ project that that can call both systemc
functions and x264 functions. What I've done is I've linked both
libraries into my project, using an additional header file to include
the C functions from x264 as follows:

Evan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFBWhbyoo/Prlj9GScRAsFAAJ94KkfYpLRYimfi67IXQri1UlPujQCfQh9u
6DnvTqw+q+58aCBKRzjHoV0=
=cJrl
-----END PGP SIGNATURE-----
Jul 22 '05 #3

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

Similar topics

9
by: Francesco Moi | last post by:
Hello. I'm trying to build a RSS feed for my website. It starts: ----------------//--------------------- <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE rss PUBLIC "-//Netscape...
6
by: Nikolaos Giannopoulos | last post by:
If I have simplified html (I have removed height, weight, alt, etc... attributes to simplify the example) such as: <div id="header"> <a href="blah.html"><img src="img/blah.jpg"></a> </div> ...
4
by: Doors of Perception | last post by:
As you probably know, when you click on a link in MSIE and go to a page, then when you click the "back" button, you see a dotted box outlining the link on which I just clicked. As far as I'm...
14
by: Steve McLellan | last post by:
Hi, Sorry to repost, but this is becoming aggravating, and causing me a lot of wasted time. I've got a reasonably large mixed C++ project, and after a number of builds (but not a constant...
10
by: Ian Lazarus | last post by:
Hello. How do "unresolved token" link errors occur. How do I fix them? Linking... LINK : error LNK2020: unresolved token (0A000015) ??_7type_info@@6B@ LINK : error LNK2020: unresolved token...
4
by: Mike Woinoski | last post by:
(I'm new to VS, so please forgive me if this is a faq.) I'm writing some Java web services and need to test them with C++ clients. I can use either a Windows Form application or an MFC application....
3
by: debbie | last post by:
I have an Access 2002 program that I install using Wise. The first thing my program does when a front end is opened is re-link, then it checks the version and if needed upgrades the backend. My...
3
by: Andreas | last post by:
Hi! I'm currently developing a DLL that makes use of C++ and .net (mixed) using Visual Studio 2003. Now, as I wanted to move to the new Visual Studio 2005, I converted this project into the...
4
by: ben.dixon | last post by:
Hi, I'm using links for navigation on a test page, so each link will go to a question in the test e.g. Question 1, Question 2 etc. For each link i am using an Outer Border, Middle border and...
8
by: Neil | last post by:
I just started using Access 2003, and I can't link a SQL Server table. I right-click on the database window; select Link Tables; and select ODBC Databases from the Files of Type dropdown. As soon...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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,...
0
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...

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.