LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Input file is not a valid archive

Solved!
Go to solution

Hello all.

 

 

I have a library I'm trying to convert to a static lib. I have the source, headers, and the latest versions of the libraries dependencies. When I try to include this lib into my main project I get the following "error: Input file is not a valid archive: 'locationhere\library.lib'". The project builds if I include the source file.

 

This has been rebuilt several times before without fail and I'm compiling both my main project and the library in 2017. I've tired cleaning before building the main project and library. I've built the library in release and debug with no luck.

 

What else can I try?

 

Thanks.

 

 

---------------------

This issue has been discussed and solved before, but following the other threads I couldn't achieve the same. 

 

Similar thread(s): https://forums.ni.com/t5/LabWindows-CVI/input-file-not-a-valid-archive/td-p/3075098

0 Kudos
Message 1 of 8
(3,700 Views)

Hi there,

 

When you say that it has worked before, what exactly worked?

What has changed between when it worked an now?

 

-Mitchel | NI

0 Kudos
Message 2 of 8
(3,664 Views)

My apologies for being so late.

 

What worked was compiling the program with the .LIB.

 

What has changed seems to have been two functions that were added in the .c file and one function in the .h file.

 

In terms of the .prj and .cws I'm unsure. Most likely all that was changed was selecting and deselecting which LIBs to include. I wouldn't have changed any build options because I really have no reason to fool around there.

 

-Dwayne

 

 

0 Kudos
Message 3 of 8
(3,617 Views)

Hi Dwayne,

 

What are the functions that were added?

 

-Mitchell

0 Kudos
Message 4 of 8
(3,605 Views)

 

In the source I added anything that has "//new line" beside it

void __stdcall DrwrEnable(int n, int state)
{
	char rlyName [256] = {0};
	
	if (n>14) //new line
		n-=15; //new line
	 //new line
	sprintf(rlyName, "EN_DRWR%d",n+1);
	WriteSignal(DIO, rlyName , (void*)state);
}

/********************************************//**
* Turn 24V on/off
***********************************************/
void __stdcall ResetLight (int state)
{
	WriteSignal(DIO, "ResetLight" , (void*)state);
}//new line
/********************************************//** //new line
* Switch CAN to rack 2 //new line
***********************************************/ //new line
void __stdcall CAN_RCK2 (int state)//new line
{//new line
	WriteSignal(DIO, "CAN_RCK2" , (void*)state);//new line
}

 

In the header I added the following

void __stdcall CAN_RCK2 (int state);//newline
//newline
//newline
0 Kudos
Message 5 of 8
(3,597 Views)

I found out that the last time it was working was when I had the PRJ file synced with GitHub. I accidentally removed the CWS and PRJ file from the GitRepo, but continued to work (unsure why this would change anything). 

 

Comparing PRJ files I see mostly pathing changes, with some inclusion/exclusion differences, and files were shuffled around. The latter point I mean to say that the order of which they're stored in the PRJ file is different, but they're available. 

 

It might be worth noting that I would develop on PC A, move to PC B to upload to git, and sometimes work on PC C with git before returning back to PC A (which had no internet access).

0 Kudos
Message 6 of 8
(3,535 Views)

Following a comment in a different thread I tried to compiling the LIB in a different project and was unsuccessful.

 

It was then suggested to start removing code to find the cause of the issue. 

The first step I've done was to exclude the entire file. Then section by section I started including the following with success, headers, static variables, and static functions.

 

The moment I included any global function (that was untouched from before & after the issue occurred) I received the same "Input file is not a valid archive 'path\file.lib' " error. 

 

Prior to adding any global functions I'd receive many "Undefined symbol" errors, since those functions were never compiled into the LIB. 

0 Kudos
Message 7 of 8
(3,395 Views)
Solution
Accepted by topic author Dwayne_Arxtron

I found a solution, but am still unsure of the root cause. We have some speculation though, see below.

 

Project contains

  Library A

  Library B

 

Library A contains

  Library B

 

Library B contains

  Library A

 

With both instances of compiling Library A or B into a .LIB we had success. Upon building the project, that's when the error occurred. As seen above, we used Library A in Library B and vise-versa. We believe this cyclical linking caused the failure upon project compilation.

 

It was suggested to me that instead of using the .lib of each file, we try using the source of each library to compile the individual libraries. After I included the source, the error was removed. 

0 Kudos
Message 8 of 8
(3,331 Views)