473,698 Members | 2,392 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_ca tch'
sc_main.o(.text +0x92): undefined reference to
`std::basic_ost ream<char, std::char_trait s<char> >& std::endl<char,
std::char_trait s<char> >(std::basic_os tream<char,
std::char_trait s<char> >&)'
sc_main.o(.text +0xa7): undefined reference to `std::cout'
sc_main.o(.text +0xac): undefined reference to
`std::basic_ost ream<char, std::char_trait s<char> >& std::operator<<
<std::char_trai ts<char> >(std::basic_os tream<char,
std::char_trait s<char> >&, char const*)'
sc_main.o(.text +0xb5): undefined reference to
`std::basic_ost ream<char, std::char_trait s<char> >& std::operator<<
<std::char_trai ts<char> >(std::basic_os tream<char,
std::char_trait s<char> >&, char const*)'
sc_main.o(.text +0xbe): undefined reference to
`std::basic_ost ream<char, std::char_trait s<char>
::operator<<(s td::basic_ostre am<char, std::char_trait s<char> >& (*)(std::basic_ ostream<char, std::char_trait s<char> >&))'
sc_main.o(.text +0xc6): undefined reference to `__cxa_end_catc h'
sc_main.o(.text +0xd5): undefined reference to `__cxa_begin_ca tch'
sc_main.o(.text +0xe4): undefined reference to
`std::basic_ost ream<char, std::char_trait s<char> >& std::endl<char,
std::char_trait s<char> >(std::basic_os tream<char,
std::char_trait s<char> >&)'
sc_main.o(.text +0xf5): undefined reference to `std::cout'
sc_main.o(.text +0xfa): undefined reference to
`std::basic_ost ream<char, std::char_trait s<char> >& std::operator<<
<std::char_trai ts<char> >(std::basic_os tream<char,
std::char_trait s<char> >&, char const*)'
sc_main.o(.text +0x103): undefined reference to
`std::basic_ost ream<char, std::char_trait s<char> >& std::operator<<
<std::char_trai ts<char> >(std::basic_os tream<char,
std::char_trait s<char> >&, char const*)'
sc_main.o(.text +0x10c): undefined reference to
`std::basic_ost ream<char, std::char_trait s<char>::operator<<(s td::basic_ostre am<char, std::char_trait s<char> >& (*)(std::basic_ ostream<char, std::char_trait s<char> >&))'
sc_main.o(.text +0x117): undefined reference to `__cxa_begin_ca tch'
sc_main.o(.text +0x11e): undefined reference to
`std::basic_ost ream<char, std::char_trait s<char> >& std::endl<char,
std::char_trait s<char> >(std::basic_os tream<char,
std::char_trait s<char> >&)'
sc_main.o(.text +0x12f): undefined reference to `std::cout'
sc_main.o(.text +0x134): undefined reference to
`std::basic_ost ream<char, std::char_trait s<char> >& std::operator<<
<std::char_trai ts<char> >(std::basic_os tream<char,
std::char_trait s<char> >&, char const*)'
sc_main.o(.text +0x13d): undefined reference to
`std::basic_ost ream<char, std::char_trait s<char> >& std::operator<<
<std::char_trai ts<char> >(std::basic_os tream<char,
std::char_trait s<char> >&, char const*)'
sc_main.o(.text +0x146): undefined reference to
`std::basic_ost ream<char, std::char_trait s<char>::operator<<(s td::basic_ostre am<char, std::char_trait s<char> >& (*)(std::basic_ ostream<char, std::char_trait s<char> >&))'
sc_main.o(.text +0x153): undefined reference to `__cxa_end_catc h'
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_e xcept_table+0x2 c):
undefined reference to `typeinfo for char const*'
.../common/systemc/lib-linux/libsystemc.a(sc _main.o)(.eh_fr ame+0x12):
undefined reference to `__gxx_personal ity_v0'
.../common/systemc/lib-linux/libsystemc.a(sc _simcontext.): In function
`_GLOBAL__I__ZN 16sc_process_ta bleC2Ev':
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_ca tch'
sc_simcontext.( .text+0x6a6): undefined reference to
`std::basic_ost ream<char, std::char_trait s<char> >& std::endl<char,
std::char_trait s<char> >(std::basic_os tream<char,
std::char_trait s<char> >&)'
sc_simcontext.( .text+0x6bf): undefined reference to `std::cout'
sc_simcontext.( .text+0x6c4): undefined reference to
`std::basic_ost ream<char, std::char_trait s<char> >& std::operator<<
<std::char_trai ts<char> >(std::basic_os tream<char,
std::char_trait s<char> >&, char const*)'
sc_simcontext.( .text+0x6cd): undefined reference to
`std::basic_ost ream<char, std::char_trait s<char> >& std::operator<<
<std::char_trai ts<char> >(std::basic_os tream<char,
std::char_trait s<char> >&, char const*)'
sc_simcontext.( .text+0x6d6): undefined reference to
`std::basic_ost ream<char, std::char_trait s<char>::operator<<(s td::basic_ostre am<char, std::char_trait s<char> >&

(*)(std::basic_ ostream<char, std::char_trait s<char> >&))'
sc_simcontext.( .text+0x6e2): undefined reference to `__cxa_end_catc h'
Thanks for your help.

Stephen
Jul 22 '05 #1
2 3379
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/Prlj9GScRAsFAAJ 94KkfYpLRYimfi6 7IXQri1UlPujQCf Qh9u
6DnvTqw+q+58aCB KRzjHoV0=
=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
2959
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 Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd"> <rss version="0.91"> ----------------//----------------------
6
17485
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> and the following CSS rule to apply a background color to text links on hover:
4
8503
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 aware, no versions of Opera support this desired capability natively, so I've experimented, as best I could, with using a custom CSS file which contains the following: a:hover { outline: 2px dotted black; }
14
2830
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 number) linking (and sometimes compiling) becomes immensely slow, and task manager shows that link.exe (or cl.exe) is barely using any processor time, but an awful lot of RAM (around 150-200MB). I'm going to keep an eye on page faults since I can't...
10
7604
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 (0A000016) _CxxThrowException LINK : error LNK2020: unresolved token (0A000018) exception.__ctor LINK : error LNK2020: unresolved token (0A000019) exception.__ctor LINK : error LNK2020: unresolved token (0A00001A) exception.__dtor LINK : error...
4
3918
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. I used VS.NET 2003 to create a C# client that successfully processes SOAP messages to and from the Java service. However, I'm having problems with the C++ client. I created a new solution and a new project with File > New > Visual C++ Projects...
3
2170
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 problem is that I have a new front end version upgrade that creates several new tables in the backend and then links them. So when the program opens up it checks the version in the backend and if needed creates new tables & new links. Now when...
3
1967
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 new format (compiling with /clr:OldSyntax): everything works and compiles fine. Unfortunately, I cannot link to the newly created DLL from any other application/DLL: LNK2019: unresolved external symbol. I've checked the DLL
4
2138
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 Inner border, each with their own color depending on the status of the question (e.g. Read, Answered, Viewed etc.) so that the user can distinguish between questions they've answered and one they haven't answered.
8
3038
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 as I select ODBC Databases from the Files of Type dropdown, the entire dialog box disappears. No error message. Just disappears, and I'm back at the database window. I have tried this with other databases, including a brand new blank one, and...
0
8678
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9166
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9030
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8871
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4371
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2333
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.