2013-04-08 49 views
2

在Linux上开发对我来说是新的,而且我在设置环境时遇到了问题。我有一个比较小的程序,它依赖于以下库:在Linux上设置链接库

-lboost_date_time -lboost_regex -lmysqlclient -lmysqlcppconn -lexpat 

我使用Ubuntu的LTS 12.04日食。我需要做什么与包管理器,并在eclipse内成功编译?我被告知要使用sudo apt-get libboost*,但打印的冲突全军,然后来到了伤感的结论:

E: Unable to correct problems, you have held broken packages. 

我相信我安装libmysqlcppconn-devlibexpat1-dev正确。 我在eclipse中完成的唯一事情是将-l内容添加到链接器库设置中。

所以总而言之,操作系统和IDE对我来说都是新的,我希望能有详细的帮助。从下面的终端

转储:

libboost-dev is already the newest version. 
libboost-iostreams1.46.1 is already the newest version. 
libboost-iostreams1.46.1 set to manually installed. 
libboost-serialization1.46.1 is already the newest version. 
libboost-serialization1.46.1 set to manually installed. 
libboost1.46-dev is already the newest version. 
libboost1.46-dev set to manually installed. 
Some packages could not be installed. This may mean that you have 
requested an impossible situation or if you are using the unstable 
distribution that some required packages have not yet been created 
or been moved out of Incoming. 
The following information may help to resolve the situation: 

The following packages have unmet dependencies: 
libboost-date-time1.48-dev : Conflicts: libboost-date-time1.46-dev but 1.46.1-7ubuntu3 is to be installed 
libboost-filesystem1.48-dev : Conflicts: libboost-filesystem1.46-dev but 1.46.1-7ubuntu3 is to be installed 
libboost-graph-parallel1.48-dev : Conflicts: libboost-graph-parallel1.46-dev but 1.46.1-7ubuntu3 is to be installed 
libboost-graph1.48-dev : Conflicts: libboost-graph1.46-dev but 1.46.1-7ubuntu3 is to be installed 
libboost-iostreams1.48-dev : Conflicts: libboost-iostreams1.46-dev but 1.46.1-7ubuntu3 is to be installed 
libboost-math1.48-dev : Conflicts: libboost-math1.46-dev but 1.46.1-7ubuntu3 is to be installed 
libboost-mpi-python1.48-dev : Conflicts: libboost-mpi-python1.46-dev but 1.46.1-7ubuntu3 is to be installed 
libboost-mpi-python1.48.0 : Conflicts: libboost-mpi-python1.46.1 but 1.46.1-7ubuntu3 is to be installed 
libboost-mpi1.48-dev : Conflicts: libboost-mpi1.46-dev but 1.46.1-7ubuntu3 is to be installed 
libboost-program-options1.48-dev : Conflicts: libboost-program-options1.46-dev but 1.46.1-7ubuntu3 is to be installed 
libboost-python1.46-dev : Depends: python-dev but it is not going to be installed 
libboost-python1.48-dev : Depends: python-dev but it is not going to be installed 
          Conflicts: libboost-python1.46-dev but 1.46.1-7ubuntu3 is to be installed 
libboost-regex1.48-dev : Conflicts: libboost-regex1.46-dev but 1.46.1-7ubuntu3 is to be installed 
libboost-serialization1.48-dev : Conflicts: libboost-serialization1.46-dev but 1.46.1-7ubuntu3 is to be installed 
libboost-signals1.48-dev : Conflicts: libboost-signals1.46-dev but 1.46.1-7ubuntu3 is to be installed 
libboost-system1.48-dev : Conflicts: libboost-system1.46-dev but 1.46.1-7ubuntu3 is to be installed 
libboost-test1.48-dev : Conflicts: libboost-test1.46-dev but 1.46.1-7ubuntu3 is to be installed 
libboost-thread1.48-dev : Conflicts: libboost-thread1.46-dev but 1.46.1-7ubuntu3 is to be installed 
libboost-wave1.48-dev : Conflicts: libboost-wave1.46-dev but 1.46.1-7ubuntu3 is to be installed 
libboost1.48-dbg : Conflicts: libboost1.46-dbg but 1.46.1-7ubuntu3 is to be installed 
libboost1.48-dev : Conflicts: libboost1.46-dev but 1.46.1-7ubuntu3 is to be installed 
libboost1.48-doc : Conflicts: libboost1.46-doc but 1.46.1-7ubuntu3 is to be installed 
E: Unable to correct problems, you have held broken packages. 
+0

我们将不胜感激详细的问题;我认为你需要从'apt-get'添加你的错误。 – 2013-04-08 08:12:05

+0

请发布你得到的冲突消息。通常你可以使用'sudo apt-get -f install'来解决你的问题。 – Atropo 2013-04-08 08:12:29

+0

这真的是一个软件包安装问题,而不是其他任何东西:'apt-get'告诉你你已经拿到了软件包,是否安装了第三方软件包(可能是eclipse)?这是全新安装还是从以前版本的Ubuntu升级? – didierc 2013-04-08 08:16:24

回答

3

libboost-dev是一个虚包指向部署在库中的最新升压开发包集。目前,对于你的Ubuntu版本来说,最新的版本是1.48.02(见package description)。在版本库中可能有其他版本,例如1.46,这似乎是在12.04发布时可用的版本。

当启动:

apt-get install liboost* 

包管理器将尝试安装每个包的名称以libboost开始,而不仅仅是最新的版本。您真正想要的只是安装一套开发包(以及您可能需要用于应用程序的所有运行时包),但这将由依赖关系跟踪器apt来处理。

以下命令:

apt-get update 
apt-get install libboost-dev 

aptitude install libboost-dev 

应该将系统升级到可用的升压dev软件包的最新版本。

+0

你也可以尝试askubuntu.com,它也是stackexchange网络的一部分,或者ubuntu论坛。 – didierc 2013-04-08 10:39:55

+0

谢谢,这工作得很好! – Innkeeper 2013-04-09 10:51:15

+0

不客气,乐意帮忙! – didierc 2013-04-09 11:01:54