LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-10-2007, 02:49 AM   #1
queency
LQ Newbie
 
Registered: Jun 2007
Posts: 16

Rep: Reputation: 0
linking question


Hi guys:

when i: g++ main.cc databaseWrap.cc /usr/lib/libsqlite3.so.0
everythink compiled and linked ok !

when i gcc main.cc databaseWrap.cc
all compiled ok!

when i:ld main.o databaseWrap.o /usr/lib/libstdc++.so.6 /usr/lib/libsqlite3.so.0

ld: warning: cannot find entry symbol _start; defaulting to 0000000000400848
main.o: In function `__static_initialization_and_destruction_0(int, int)':
main.cc.text+0x28): undefined reference to `__dso_handle'

what is wrong with my linkage section ??
 
Old 11-10-2007, 04:23 AM   #2
keratos
Member
 
Registered: May 2007
Location: London, UK.
Distribution: Major:FC8. Others:Debian;Zenwalk; Arch; Slack; RHEL.
Posts: 544

Rep: Reputation: 30
well your programs cleary depend on other modules in which a variable, class or function is expected to be found, but has not.

__dso_handle in this case!

without knowing the source code, its impossible to say more.
 
Old 11-10-2007, 05:48 PM   #3
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
You need to link C++ programs with g++ instead of ld because there are built-in things in C++ which require hidden code. In this case, there's a non-POD static object somewhere in your program which needs to be constructed/destructed outside of main. It's probably cin/cout/cerr that are in need of construction. There's no way around it, but it's the price you pay for C++.
ta0kira
 
  


Reply



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
Symlink/Linking Question crazy4bass Linux - General 1 04-22-2005 06:37 PM
Simple Linking Question inescapeableus Linux - Software 5 10-12-2004 12:07 AM
library linking question. shaggz Linux - General 1 04-25-2004 11:22 PM
easy linking question bosewicht Linux - Newbie 1 12-17-2003 02:52 PM
apache linking question jzs9783 Linux - Newbie 3 06-22-2002 05:19 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:46 PM.

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