我有一个项目"Logger",其中配置类型是.dll.
"Logger"使用"libconfig"(开源配置解析器).目前,我有一个单独的"libconfig"项目,其配置类型是.lib
我将"libconfig"添加到Logger的框架和引用设置:
在Logger的链接器命令行中,我看到:/ IMPLIB:"path\to\Logger.lib"
我的问题是:为什么需要创建Logger.lib?我看到/ OUT ="path\to\Logger.dll",但我试图抓住visual studio的构建过程.
从M $的IMPLIB文档中,我看到了LINK过程的一部分.我还是不明白.
编辑:我没有提到如何使用Logger DLL.我的应用程序将在运行时加载它(因为只有特定的cmd行args才需要此功能)
一些应用程序使用https://github.com/hyperrealm/libconfig来生成配置文件。我想知道是否有任何包装器或库或任何一般的方式可以parse/write这种来自磁盘的配置文件但使用 javascript。
我有问题的文件看起来像:
devices: (
{
name: "Mouse";
dpi: 1200;
buttons: (
{
cid: 0xc3;
action = {
type: "Click";
}
}
)
}
);
Run Code Online (Sandbox Code Playgroud) 我使用libconfig下载存档,但我不会将其安装到系统中.我想将它编译为静态库并从程序目录链接它或在程序编译时将其直接链接到我的程序中?
有任何想法如何使用Makefile做到这一点?(FreeBSD(UNIX),GCC)或建议其他支持编译到程序中的unix配置库.
我正在尝试构建一个游戏引擎,我已经转向 libconfig 来处理我的所有配置需求。我正在构建一个资产管理器,它将使用由 libconfig 解析的配置文件来加载图像、声音等。
当我尝试编译项目时遇到了一个问题。这是导致错误的代码区域:
AssetManager::AssetManager(GameEngine *engine){
_engine = engine;
_config = new Config(); // <-- ERROR ( this is line 5 )
string path = string(ASSET_DIRECTORY);
path += "assets.cfg";
try {
_config->readFile( path.c_str() ); //<-- ERROR ( this is line 11 )
} catch ( const FileIOException &fioex ){
cout << "File exception" << endl;
} catch ( const ParseException &pex ){
cout << "Parse exception" << endl;
}
}
Run Code Online (Sandbox Code Playgroud)
这是错误:
AssetManager.o: In function 'AssetManager':
/home/sean/Code/C++/Ridiculous/src/engine/AssetManager.cpp:5: undefined reference …Run Code Online (Sandbox Code Playgroud) 我正在开发一个小型仿真软件,它依赖于两个库,GSL和libconfig.作为构建系统,我使用CMake.对于GSL和libconfig,我找到了cmake文件并将它们复制到cmake/我的项目目录中.
场景如下:我希望项目有几种不同的构建类型,比如debug,release等等,还有一个自定义的构建类型cluster,它会添加-static到GCC标志和链接.a到GSL和libconfig 的库,我假设存在.
CMakeLists.txt到目前为止我看起来像这样:
# version
SET(PACKAGE_VERSION "1.0")
SET(PACKAGE_NAME "INTERFACE")
PROJECT(interface C CXX)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
# dirs -----------------------------------------------------
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
FIND_PACKAGE(GSL REQUIRED)
INCLUDE_DIRECTORIES(${GSL_INCLUDE_DIRS})
SET(LIBS ${LIBS} ${GSL_LIBRARIES})
FIND_PACKAGE(LibConfig REQUIRED)
INCLUDE_DIRECTORIES(${LIBCONFIG_INCLUDE_DIRS})
SET(LIBS ${LIBS} ${LIBCONFIG_LIBRARIES})
CONFIGURE_FILE("res/config.h.in" "config.h")
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
SET_DIRECTORY_PROPERTIES(PROPERTIES
ADDITIONAL_MAKE_CLEAN_FILES "config.h"
)
# compilation ----------------------------------------------
ADD_EXECUTABLE( interface
interface.c interface.h config.h
helpers.c
output.c
lattice.c
genetic.c
)
# optional CFLAGS
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -std=c99")
SET(CMAKE_C_FLAGS_RELEASE "-O3 -ffast-math")
SET(CMAKE_C_FLAGS_CLUSTER "-O3 …Run Code Online (Sandbox Code Playgroud) 我即将使用libconfig编译一个非常简单的'Hello,world'.但是当我编译这样的代码时:
#include <iostream>
#include <libconfig.h++>
libconfig::Config cfg;
std::string target = "World";
int main(void)
{
try
{
cfg.readFile("greetings.cfg");
}
catch (const libconfig::FileIOException &fioex)
{
std::cerr << "I/O error while reading file." << std::endl;
return 1;
}
catch (const libconfig::ParseException &pex)
{
std::cerr << pex.getFile() << " " << pex.getLine()
<< ": " << pex.getError() << std::endl;
return 1;
}
try
{
target = cfg.lookup("target");
}
catch (const libconfig::SettingNotFoundException &nfex)
{
std::cerr << "No target set in configuration file. Using default." << …Run Code Online (Sandbox Code Playgroud)