Click here to Skip to main content
15,886,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi every one.
I have read a document from nist website (http://csrc.nist.gov/groups/ST/toolkit/rng/documentation_software.html) in this document said that" With minor modifications, source code may be ported to different platforms. The NIST source code was ported to a Windows XP system running Visual Studio 2005 compiler".(that the source code compile with gcc compiler) and so I compile the source code in VC++ but take 6Warning and when Irun the program take 7 Error!?
I need the dll format from these source code and using them with jni.
Please help me. I have to resolve this problem.
Posted
Comments
Christian Graus 13-Jul-11 0:35am    
Well, perhaps a starting point is to tell us what code has the errors, and what the errors are ?
saideh86 13-Jul-11 3:54am    
I have download sts2.1.1 codes. The assess.c is in here:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "../include/decls.h"
#include "../include/cephes.h"
#include "../include/utilities.h"

void partitionResultFile(int numOfFiles, int numOfSequences, int option, int testNameID);
void postProcessResults(int option);
int cmp(const double *a, const double *b);
int computeMetrics(char *s, int test);

int
main(int argc, char *argv[])
{
int i;
int option; /* TEMPLATE LENGTH/STREAM LENGTH/GENERATOR*/
char *streamFile; /* STREAM FILENAME */


if ( argc != 2 ) {
printf("Usage: %s <stream length="">\n", argv[0]);
printf(" <stream length=""> is the length of the individual bit stream(s) to be processed\n");
return 0;
}

tp.n = atoi(argv[1]);
tp.blockFrequencyBlockLength = 128;
tp.nonOverlappingTemplateBlockLength = 9;
tp.overlappingTemplateBlockLength = 9;
tp.approximateEntropyBlockLength = 10;
tp.serialBlockLength = 16;
tp.linearComplexitySequenceLength = 500;
tp.numOfBitStreams = 1;
option = generatorOptions(&streamFile);
chooseTests();
fixParameters();
openOutputStreams(option);
invokeTestSuite(option, streamFile);
fclose(freqfp);
for( i=1; i<=NUMOFTESTS; i++ ) {
if ( stats[i] != NULL )
fclose(stats[i]);
if ( results[i] != NULL )
fclose(results[i]);
}
if ( (testVector[0] == 1) || (testVector[TEST_CUSUM] == 1) )
partitionResultFile(2, tp.numOfBitStreams, option, TEST_CUSUM);
if ( (testVector[0] == 1) || (testVector[TEST_NONPERIODIC] == 1) )
partitionResultFile(MAXNUMOFTEMPLATES, tp.numOfBitStreams, option, TEST_NONPERIODIC);
if ( (testVector[0] == 1) || (testVector[TEST_RND_EXCURSION] == 1) )
partitionResultFile(8, tp.numOfBitStreams, option, TEST_RND_EXCURSION);
if ( (testVector[0] == 1) || (testVector[TEST_RND_EXCURSION_VAR] == 1) )
partitionResultFile(18, tp.numOfBitStreams, option, TEST_RND_EXCURSION_VAR);
if ( (testVector[0] == 1) || (testVector[TEST_SERIAL] == 1) )
partitionResultFile(2, tp.numOfBitStreams, option, TEST_SERIAL);
fprintf(summary, "------------------------------------------------------------------------------\n");
fprintf(summary, "RESULTS FOR THE UNIFORMITY OF P-VALUES AND THE PROPORTION OF PASSING SEQUENCES\n");
fprintf(summary, "------------------------------------------------------------------------------\n");
fprintf(summary, " generator is <%s>\n", streamFile);
fprintf(summary, "------------------------------------------------------------------------------\n");
fprintf(summary, " C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 P-VALUE PROPORTION STATISTICAL TEST\n");
fprintf(summary, "------------------------------------------------------------------------------\n");
postProcessResults(option);
fclose(summary);

return 1;
}

void
partitionResultFile(int numOfFiles, int numOfSequences, int option, int testNameID)
{
int i, k, m, j, start, end, num, numread;
float c;
FILE **fp = (FILE **)calloc(numOfFiles+1, sizeof(FILE *));
int *results = (int *)calloc(numOfFiles, sizeof(int *));
char *s[MAXFILESPERMITTEDFORPARTITION];
char resultsDir[200];

for ( i=0; i
saideh86 13-Jul-11 4:04am    
The errors are in here:
assess.obj : error LNK2001: unresolved external symbol _invokeTestSuite
assess.obj : error LNK2001: unresolved external symbol _openOutputStreams
assess.obj : error LNK2001: unresolved external symbol _fixParameters
assess.obj : error LNK2001: unresolved external symbol _chooseTests
assess.obj : error LNK2001: unresolved external symbol _generatorOptions
assess.obj : error LNK2001: unresolved external symbol _cephes_igamc
Debug/assess.exe : fatal error LNK1120: 6 unresolved externals
I have change the header to solve these errors but the errors have no reduce/change !!
Richard MacCutchan 13-Jul-11 5:56am    
These are linker errors which means you are missing some .obj or .lib files from your project. This has nothing to do with header files which are used by the compiler.
saideh86 13-Jul-11 6:13am    
thanks but what can I do to solve this.

Look at the libraries specified in the linker options of the functioning code and make sure that all those are also specified in the linker options of the code giving you the errors. Like Richard mentioned, this looks like you're missing .libs.
 
Share this answer
 
Install the latest MinGW with msys

Put this new user variable in System properties -> Advanced -> Environment Variables:
PATH
C:\MinGW\bin

Open msys.bat
$ cd "path" // point to your folder where is the NIST makefile
$ make

and hopla, the assess.exe is ready for use.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900