首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >代码::块v12.11包括.lib到项目

代码::块v12.11包括.lib到项目
EN

Stack Overflow用户
提问于 2014-08-03 10:49:00
回答 1查看 185关注 0票数 0

如何将Some.lib文件添加到Code::Blocks 12.11版本的项目中?

我试图找到链接器选项(项目,构建选项只有一个邮政/预构建步骤,自定义变量,“做”命令)。#语用注释( lib,xxx.lib) -对于GCC编译器来说毫无用处,我的lib文件中的函数- SFileOpenFileEx(file, szArchivedFile, 0, &hFile)向我展示了error: not declared (即lib无法工作)。

我怎么能解决这个问题?

资料来源是:

代码语言:javascript
复制
#include "resourcemanager.h"
#include "filestream.h"

#include <physfs.h>
#include <archivelib> //mylib 

ResourceManager g_resources;

void ResourceManager::init(const char *argv0)
{
    PHYSFS_init(argv0);
    PHYSFS_permitSymbolicLinks(1);
}

void ResourceManager::terminate()
{
    PHYSFS_deinit();
}

//test function for library
bool ResourceManager::openArchive(const std::string& szArchiveName, const std::string& szArchivedFile, const std::string& szFileName)
{
    HANDLE hDat   = NULL;          // Open archive handle
    HANDLE hFile  = NULL;          // Archived file handle
    HANDLE handle = NULL;          // Disk file handle
    int    nError = ERROR_SUCCESS; // Result value

    //openArchive
    if(nError == ERROR_SUCCESS)
    {
        if(!SFileOpenArchive(szArchiveName, 0, 0, &hDat))
            nError = GetLastError();
    }

    if(nError == ERROR_SUCCESS)
    {
        if(!SFileOpenFileEx(hDat, szArchivedFile, 0, &hFile))
            nError = GetLastError();
    }

    //file opens, return true. just test.
    return true;
}

在此范围内未声明“SFileOpenArchive”的错误是行:340

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-08-03 12:30:36

这是编译错误,而不是链接错误,所以这个问题与库无关。您需要使该函数的声明可见,这通常是通过包含一个标头来完成的。

如果您想要的是SFileOpenArchive中的StormLib (这将是问题中包含的有用信息),那么文档就清楚地声明头是StormLib.h,所以需要添加

代码语言:javascript
复制
#include "StormLib.h"

去你的节目。

编辑:如果之后有链接问题,请参阅如何用代码::块链接到库?

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25103935

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档