<!>启动时出错:使用sqlite3时,无法在OMNET ++项目中加载库 [英] <!> Error during startup: Cannot load library in OMNET++ project while using sqlite3
问题描述
我有一个OMNET ++项目,CSW ,通过 Project-> Properties-> Project 引用引用其他OMNET ++项目。
对项目的引用 CB_CSW_Vehicle 工作正常。我将项目 - >属性 - > OMNET ++ - > Makemake-> Options-> Target 标记为共享库。所以我有一个 libCB_CSW_Vehicle.dll ,它由主程序CSW 使用。运行 CSW 的模拟,使用 CB_CSW_Vehicle 没有问题。
对另一个项目的引用 CB_CSW_Cloud ,不行。我做了相同的步骤:
- 标记创建共享库在 OMNET ++ - > Makimake-> Options-> Target
- 在主项目的属性 - >项目引用中检查项目 CB_CSW_Cloud
我可以构建我的主项目CSW 。我也可以构建libCB_CSW_Cloud.dll 。当我从项目 CSW 运行模拟时,我收到一条错误:
<!>启动时出错:无法加载库../../../CB_CSW_Cloud/src//libCB_CSW_Cloud.dll:操作成功完成。
这两个项目的唯一区别是,CB_CSW_Cloud 使用 sqlite3 库。我将以下步骤添加到项目中:
- 设置项目 - >属性 - > OMNET ++ - > Makemake->链接 - >其他库链接(-l选项): sqlite3
- 设置项目 - >属性 - > C / C ++通用 - >路径和符号 - >库路径: C:/ sqlite
由于我没有收到一些确切信息,为什么没有加载libCB_CSW_Cloud ,我不知道是什么原因造成的。我使用它完全相同的方式,像其他项目 CB_CSW_Vehicle ,这是有效的。这导致我的建议, sqlite3 库导致问题。可能吗?项目CSW 可以引用另一个项目 CB_CSW_Cloud ,它本身使用一个库 sqlite3 ?或者我还要将这个库添加到CSW ?
您可以帮助我运行CSW 项目吗?
更新:我解决了在运行配置中添加sqlite3库并复制CB_CSW_Cloud的源代码的问题>和 CB_CSW_Vehicle 项目投放到CSW 项目。在OMNET ++中很难有很多项目。
你必须添加链接到 c
项目的运行配置中的sqlite3 库。转到运行
| 运行配置...
|主要选项卡| 更多>>
和动态库
将路径写入 sqlite3
图书馆。请注意,路径必须是相对于工作目录,而没有 dll
后缀,没有 lib
前缀。
如果$ code> sqlite3 的 dll
文件不包含 lib
前缀,尝试重命名它(例如从 sqlite3.dll
到 libsqlite3.dll
)。 / p>
I have an OMNET++ project, CSW, that references other OMNET++ projects via Project->Properties->Project References.
The reference to the project CB_CSW_Vehicle works fine. I marked for this project Project->Properties->OMNET++->Makemake->Options->Target as shared library. So I have a libCB_CSW_Vehicle.dll, which is used by the main project CSW. Simulations from CSW run, using CB_CSW_Vehicle without problems.
The reference to the other project CB_CSW_Cloud, doesn't work. I made the same steps for it:
- marked "create shared library" in OMNET++->Makemake->Options->Target
- checked the project CB_CSW_Cloud in Properties->Project References of the main project
I can build my main project CSW. I can also build libCB_CSW_Cloud.dll. When I run a simulation from project CSW, I receive an error:
<!> Error during startup: Cannot load library '../../../CB_CSW_Cloud/src//libCB_CSW_Cloud.dll': The operation completed successfully.
The only difference between these two projects, is that CB_CSW_Cloud uses sqlite3 library. I added it to the project with following steps:
- set Project->Properties->OMNET++->Makemake->Options->Link->Additional Libraries to link with (-l option): sqlite3
- set Project->Properties->C/C++General->Paths And Symbols->Library Paths: C:/sqlite
Since I don't receive some exact information, why libCB_CSW_Cloud was not loaded, I don't know what causes the problem. I use it in exactly the same way, as other project CB_CSW_Vehicle, that works. This leads me to the suggestion, that the sqlite3 library causes the problem. Is it possible? Can a project CSW have a reference to the other project CB_CSW_Cloud, that itself uses a library sqlite3? Or shall I also add this library to CSW?
Can you help me to run the CSW project?
Update: I solved my problem with adding sqlite3 library to the run configuration and copying the source code of the CB_CSW_Cloud and CB_CSW_Vehicle projects to the CSW project. It is really difficult in OMNET++ to have a lot of projects.
You have to add link to the sqlite3
library in run configuration of CSW
project. Go to Run
| Run Configurations...
| Main
tab | More>>
and in Dynamic libraries
write path to sqlite3
library. Please note that the path has to be relative to the working directory, and without a dll
suffix, without a lib
prefix.
If the dll
file of sqlite3
doesn't contain lib
prefix, try to rename it (for example from sqlite3.dll
into libsqlite3.dll
).
这篇关于<!>启动时出错:使用sqlite3时,无法在OMNET ++项目中加载库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!