Reputation: 307
How I can add a Some.lib
file to my project in Code::Blocks
12.11 version?
I am tried to find linker options (Project, Building Options have a only Post/Prebuild steps, Custom Variables, "Make" commands). #pragma comment(lib, xxx.lib
) - useless for GCC compiler, and the function from my lib file - SFileOpenFileEx(file, szArchivedFile, 0, &hFile)
showed me the error: not declared
(i.e. lib not working.)
How i can resolve this?
Source is:
#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;
}
the error is Line: 340|error: ‘SFileOpenArchive’ was not declared in this scope
Upvotes: 0
Views: 201
Reputation: 18972
That's a compilation error, not a link error, so the problem has nothing to do with libraries. You need to make a declaration of the function visible, which is normally done by including a header.
If the SFileOpenArchive
you want is the one in StormLib (which would be useful information to include in the question) then the documentation clearly states that the header is StormLib.h, so you need to add
#include "StormLib.h"
to your program.
EDIT: If after that you have linking problems, see How do I link to a library with Code::Blocks?.
Upvotes: 1