Jump to content

Anybody been able to compile Niflib c++?


cypher2012

Recommended Posts

So I managed to compile Niflib and create a new project using the library.

 

I had to download the 'develop' branch on Git. Not the master.

 

It also needed to be compiled in Visual Studio Express 2005.

 

I'm running in to problems using the code. 'ReadHeaderInfo' keeps crashing.

#include <iostream>
#include <string>

#include <niflib.h>

void Run(std::string sFileName)
{
	Niflib::NifInfo TestNifInfo;
	TestNifInfo = Niflib::ReadHeaderInfo(sFileName);
}

int main()
{
	std::string sFileName = "test2.nif";
	int iVersion = Niflib::GetNifVersion(sFileName);

	if(iVersion != Niflib::VER_INVALID)
	{
		if(iVersion == Niflib::VER_20_2_0_7)
		{
			std::cout << "Found a valid Fallout 4 file!" << std::endl;
			Run(sFileName);
		}
		else
		{
			std::cout << "NIF is not a Fallout 4 file!" << std::endl;
		}		
	}
	else
	{
		std::cout << "File was not a valid NIF file!" << std::endl;
	}
	std::cin.get();
}
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...