Solved

How to compile Linux C++ code by VS2005 on WinXP?

Posted on 2008-06-11
10
1,055 Views
Last Modified: 2013-12-14
I have Visual Studio 2005 Professional and Windows XP Pro.
I downloaded a c++ code for Linux, but i want to compile it on WinXP platform by Visual Studio 2005.
Is there a way to compile a c++ software for linux on windowXP plateform?
In other words, how to set the flag of the preprocessor of  a c++ project (Win32 console program) to create an exe?
I set the flag in preprocessor definitions as: WIN32;_DEBUG;_CONSOLE;DCLOCK_DONE;DNoHEBP;DNoWINNT;DNoVista;DNoTcl;DMSVC

But the "DNoVista;DNoTcl;" seems not working.

Thanks
0
Comment
Question by:dcscy
10 Comments
 
LVL 14

Expert Comment

by:cuziyq
Comment Utility
Unless the package you're trying to compile targets the Windows platform specifically, then you can't.  C++ is not a write once, compile anywhere language.  You can't take C++ code written for Linux and compile it on a Windows machine.  Even if you did manage to get it compiled, you would not have the libraries and includes necessary to run it.

If the program was designed to be ported to Windows, then there should be a README file on how to do it.  If it does not, Visual Studio does have the ability to make a project file out of a makefile, but it's not a task for the faint of heart.
0
 
LVL 24

Expert Comment

by:fridom
Comment Utility
Well it's not exactly to that extrems, but close. Howerver if he happens to use the portable part of C++ than of course you can take it compile it on whatever platform you like. But we do not have got the slightes clue on what code the OP likes to compile.
Giving us some defines is useles. What do we know, what this things mean?

Now making a project from some C++ files is not really rocket science, and well there does exist nmake for Windows so some sort of maketool is available on Windows also.

The point is the question can not be answered with that sort of information.

Friedrich
0
 
LVL 53

Expert Comment

by:Infinity08
Comment Utility
Or in other words : what is the code you are trying to compile ? Does it make use of Linux specific features ?
0
 

Author Comment

by:dcscy
Comment Utility
Thanks for your help very much!
The code is for face detection, which can be download on: http://www.vasc.ri.cmu.edu/NNFaceDetector/cgi-bin/pagelog.cgi

I copied all .cpp and .h file from the downloaded file to my own VS2005 project. I need to use one of the function in this downloaded source code.

The source code has some specific setting declarations in it's makefile. and it also provided makefile for MSVC.

The code seems need to use TCL library (for Linux platform), and it need to know the current PC platform is WindowVista or not.

So the flag setting ("DNoVista;DNoTcl;" )  in preprocessor of VS2005 is to tell the program that donot use TCL library and this platform not Windows Vista. But now this setting doesnot working, as my error message shows it cannot find "tcl.h" and another header file that must be included when it runs on VIsta platform.
0
 
LVL 53

Expert Comment

by:Infinity08
Comment Utility
Can you post the header file that checks the NoVista and NoTcl defines ?


>> and it also provided makefile for MSVC.

That means the code is compilable on Windows ... Did you use that makefile ?
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:dcscy
Comment Utility

#ifndef ImageIncluded

#define ImageIncluded
 

#ifndef WINNT

extern "C" {

#endif

#ifdef NoTcl

#include "tclHash.h"

#else

#include <tcl.h>

#endif

#ifndef NoVista

#include <vista/VImage.h>

#endif

#ifndef WINNT

};

#endif
 

#define NotAnImageType 0

#define ByteImageType 1

#define FloatImageType 2
 

typedef unsigned char Byte;
 

class Image

{

  public:

  void *link;

  char *name;

  int width, height, size;
 

  Image(char *name);

  virtual ~Image();

  virtual int GetType();

  virtual void ImageToBytes(unsigned char *data, int zoom,

                            double min, double max);

  virtual void *GetBuffer() { return NULL; }

  void Change();

};
 

class ByteImage : public Image

{

  public:

  Byte *buffer;
 

  ByteImage(char *name);

  virtual ~ByteImage();

  virtual void *GetBuffer() { return buffer; }

  virtual int GetType();

  virtual void ImageToBytes(unsigned char *data, int zoom,

                            double min, double max);

  double interpolate(double x, double y);

  double interpolateExtend(double x, double y);

  double interpolateLogPolar(double x, double y);

// USED: return the i'th pixel

  unsigned char & data(int i) { return buffer[i]; }

// USED: return the pixel at (i,j)

  unsigned char & data(int i, int j) { return buffer[i+j*width]; }

  void NewBuffer(Byte *buf, int w, int h);

  Byte *AllocBuffer(int w, int h);

  void FreeBuffer();

  void ZeroBuffer(int w, int h, unsigned char fill=0);

};
 

class FloatImage : public Image

{

  public:

  float *buffer;
 

  FloatImage(char *name);

  virtual ~FloatImage();

  virtual int GetType();

  virtual void *GetBuffer() { return buffer; }

  virtual void ImageToBytes(unsigned char *data, int zoom,

                            double min, double max);

  double interpolate(double i, double j);

  float & data(int i) { return buffer[i]; }

  float & data(int i, int j) { return buffer[i+j*width]; }

  void NewBuffer(float *buf, int w, int h);

  void FreeBuffer();

  void ZeroBuffer(int w, int h);

};
 

typedef void (ImageDataFunction)(void *image);

extern ImageDataFunction *UnlinkImageDataFunction;

extern ImageDataFunction *RedrawImageDataFunction;
 

Image *FindImageWithName(char *name);

ByteImage *FindByteImageWithName(char *name);

FloatImage *FindFloatImageWithName(char *name);
 

void RotateByteImage2(ByteImage *dest, ByteImage *src, double angle);

void ZoomByteImage(ByteImage *image, double scale, ByteImage *src);

void FillRectangle(ByteImage *image,

                   int x1, int y1, int x2, int y2, int color);

void SubSampleWithAveraging(ByteImage *dest, ByteImage *src, int scale);

void ResampleByteImage(ByteImage *image, ByteImage *src,

                       int newWidth, int newHeight, double scale);

void ReduceSize(ByteImage *dest, ByteImage *src);

void SmoothByteImage(ByteImage *image);

void SaveByteImagesPpm(ByteImage *red, ByteImage *green, ByteImage *blue,

                       FILE *outf);

void SaveByteImagePgm(ByteImage *image, FILE *outf);

void LoadByteImagePgm(ByteImage *image, FILE *inf);

void LoadByteImageRaw(ByteImage *dest, int width, int height, FILE *inf);

void LoadByteImageHsi(ByteImage *dest, FILE *inf);

void CopyByteImage(ByteImage *dest, ByteImage *src);

void DifferenceImage(ByteImage *dest, ByteImage *src1, ByteImage *src2);

void ExtrantRectangle(ByteImage *dest, ByteImage *src,

                      int x, int y, int width, int height);

void ExtractAndZoom(ByteImage *dest, ByteImage *src, double scale,

                    int minX, int minY, int maxX, int maxY);

void DifferenceFloatImage(ByteImage *dest, ByteImage *src1, FloatImage *src2);

void CentroidImage(ByteImage* image, double *ax, double *ay,

                   double *vx, double *vy);

void AddImages(ByteImage *dest, ByteImage *src1, ByteImage *src2);

void Threshold(ByteImage *image, int threshold, int inv);

void SmartThreshold(ByteImage *image);

void MirrorByteImage(ByteImage *image);

void MirrorFloatImage(FloatImage *image);

double CountAboveZero(ByteImage *image);

void EvolveBackgroundImage(FloatImage *background, ByteImage *dat,

                           double rate);

void FindMotion(ByteImage *dest, ByteImage *src1, FloatImage *src2,

                int threshold, unsigned char maskValue);

void FindMotion(ByteImage *dest, ByteImage *src1, ByteImage *src2,

                int threshold, unsigned char maskValue);

#ifndef NoVista

VImage ByteImageToVista(char *byteimage);

VImage ByteImageToVista(ByteImage *image);

#endif
 

void Image_Init_NoTcl();

#ifndef NoTcl

int Image_Init(Tcl_Interp *interp);

#endif
 

extern "C" {

unsigned char *LoadPpmStreamToBuffer(FILE *inf, int *width, int *height);

unsigned char *LoadPgmStreamToBuffer(FILE *inf, int *width, int *height);

unsigned char *LoadPgmToBuffer(char *filename, int *width, int *height);

unsigned char *LoadPpmToBuffer(char *filename, int *width, int *height);

}
 

void ExtractAndRotate(ByteImage *dest, ByteImage *src, int x, int y,

                      int width, int height, double angle);

void ExtractRectangle(ByteImage *dest, ByteImage *src, int x, int y,

                      int width, int height);
 

struct WidthHeight {

  int width, height;

};
 

#endif

Open in new window

0
 

Author Comment

by:dcscy
Comment Utility
Header file that needs Vista definition

#include "stdafx.h"
 

#ifdef __GNUC__

#include <string.h>

#endif
 

#ifndef WINNT

extern "C" {

#endif

#include <stdlib.h>

#include <stdio.h>

#ifndef __GNUC__

#include <string.h>

#endif

#ifndef NoVista

#include <vista/VImage.h>

#endif

#ifndef hpux

#include <math.h>

#endif

#ifndef WINNT

#include <unistd.h>

}

#endif
 

#if defined(WINNT) && !defined(MSVC)

#include <dir.h>

#endif
 

#ifdef MSVC

#include <direct.h>

#endif
 

#ifdef hpux

#include <math.h>

#endif
 

#include "system.hpp"

#include "myhebp.hpp"
 

FastForwardStruct *real_fast=NULL;

FastForwardStruct **real_fast_list=NULL;

#ifndef NoHEBP

network *real_net;

#endif

float real_inputs[30*30];

float real_outputs[30*30*2];

float real_targets[30*30*2];

int real_numNetworks;
 

//#define Test
 

#ifndef NoTcl

int FastRandomizeWeightsCmd(ClientData, Tcl_Interp *interp,

                            int argc, char *argv[])

{

  if (argc!=2)

  {

    interp->result="Usage: FastRandomizeWeights <net>";

    return TCL_OK;

  }

  int net=atoi(argv[1]);

  FastRandomizeWeights(real_fast_list[net]);

  return TCL_OK;

}

#endif
 

#ifndef NoTcl

int TestNetworkSensitivityCmd(ClientData data, Tcl_Interp *interp,

                              int argc, char *argv[])

{

  if (argc!=8)

  {

    interp->result="Usage: TestNetworkSensitivity <network> <data-pos> <data-neg> <xs> <ys> <xb> <yb>";

    return TCL_ERROR;

  }

  FastForwardStruct *network=real_fast_list[atoi(argv[1])];

  char *dataFilePos=argv[2];

  char *dataFileNeg=argv[3];

  int xs=atoi(argv[4]);

  int ys=atoi(argv[5]);

  int xb=atoi(argv[6]);

  int yb=atoi(argv[7]);
 

  int size=xs*ys;

  int numPos=FileSize(dataFilePos);

  int numNeg=FileSize(dataFileNeg);

  numPos/=size;

  numNeg/=size;

  int numExamples=numPos+numNeg;

  signed char *dat=new signed char[numExamples*size];

  FILE *inf=fopen(dataFilePos,"r");

  fread((char*)dat,numPos*size,1,inf);

  fclose(inf);

  inf=fopen(dataFileNeg,"r");

  fread((char*)(dat+numPos*size),numNeg*size,1,inf);

  fclose(inf);

  

  Tcl_DString ds;

  Tcl_DStringInit(&ds);
 

  for (int j=0; j<ys/yb; j++)

  {

    Tcl_DStringAppend(&ds,"",-1);

    for (int i=0; i<xs/xb; i++)

    {

      int numWrong=0;

      for (int k=0; k<numExamples; k++)

      {

        for (int l=0; l<size; l++)

        {

          //          fprintf(stderr,"%d %d %d %d %08X %08X %d %d\n",i,j,k,l,network,dat,numExamples,size);

          network->unitList[l+1].activation=dat[k*size+l]/127.0;

        }

        for (int jj=j*yb; jj<(j+1)*yb; jj++)

          for (int ii=i*xb; ii<(i+1)*xb; ii++)

            network->unitList[ii+1+jj*xs].activation=RandomDouble()*2.0-1.0;

        int output=FastForwardPass(network)>0.0;

        if (k<numPos && !output) numWrong++;

        if (k>=numPos && output) numWrong++;

      }

      char tem[64];

      sprintf(tem,"%d ",numWrong);

      Tcl_DStringAppend(&ds,tem,-1);

      fprintf(stderr,".");

    }

    Tcl_DStringAppend(&ds,"\n",-1);

  }

  Tcl_DStringResult(interp,&ds);

  delete[] dat;

  fprintf(stderr,"\n");

  return TCL_OK;

}

#endif
 

#ifndef NoVista

char *TestNetworkSensitivityVista(int net, VImage posimage,

                                  char *dataFileNeg,

                                  int xb, int yb)

{

  FastForwardStruct *network=real_fast_list[net];

  int xs=VImageNColumns(posimage);

  int ys=VImageNRows(posimage);

  int size=xs*ys;

  int numPos=VImageNBands(posimage);

  int numNeg=FileSize(dataFileNeg)/size;

  int numExamples=numPos+numNeg;

  signed char *dat=new signed char[numExamples*size];

  memcpy(dat,posimage->data,numPos*size);

  FILE *inf=fopen(dataFileNeg,"r");

  fread((char*)(dat+numPos*size),numNeg*size,1,inf);

  fclose(inf);

  

  Tcl_DString ds;

  Tcl_DStringInit(&ds);
 

  for (int j=0; j<ys/yb; j++)

  {

    Tcl_DStringAppend(&ds,"",-1);

    for (int i=0; i<xs/xb; i++)

    {

      double error=0;

      for (int k=0; k<numExamples; k++)

      {

        for (int l=0; l<size; l++)

          network->unitList[l+1].activation=dat[k*size+l]/127.0;

        for (int jj=j*yb; jj<(j+1)*yb; jj++)

          for (int ii=i*xb; ii<(i+1)*xb; ii++)

            network->unitList[ii+1+jj*xs].activation=RandomDouble()*2.0-1.0;

        double output=FastForwardPass(network);

        if (k<numPos) error+=(output-1.0)*(output-1.0); else

          error+=(output+1.0)*(output+1.0);

      }

      char tem[64];

      sprintf(tem,"%g ",sqrt(error/(numPos+numNeg)));

//      fprintf(stderr,"%g ",sqrt(error/(numPos+numNeg)));

      Tcl_DStringAppend(&ds,tem,-1);

      fprintf(stderr,". ");

    }

    Tcl_DStringAppend(&ds,"\n",-1);

  }

  delete[] dat;

  fprintf(stderr,"\n");

  char *result=strdup(Tcl_DStringValue(&ds));

  Tcl_DStringFree(&ds);

  return result;

}

#endif
 

#ifndef NoHEBP

void HEBPInit(char *directory, int numNetworks, char *networkList[],

              int needbuf)

{

  real_numNetworks=numNetworks;

  net_spec *spec=new net_spec[numNetworks+1];

  for (int i=0; i<numNetworks; i++)

  {

    strcpy(spec[i].network_name,networkList[i]);

    if (needbuf)

      spec[i].num_patterns=100; else

        spec[i].num_patterns=1; 

    spec[i].num_cv_patterns=1;

    spec[i].aux_data=NULL;

  }

  spec[numNetworks].network_name[0]=0;

  real_net=HEBP_init(directory,spec,0);

  real_fast_list=new FastForwardStruct*[numNetworks];

  real_fast=FastConstructForward(real_net);

  for (i=0; i<numNetworks; i++)

  {

    real_fast_list[i]=FastConstructForward(real_net+i);

    real_net[i].ennuvits = 0;

    if (needbuf) {

      HEBP_replace_pattern_from_arrays(real_net+i,

                                       real_inputs,

                                       real_targets,

                                       HEBP_ADD_PATTERN,

                                       1, 0);

      for (int j=0; j<100; j++)

        HEBP_replace_pattern_from_arrays (real_net+i,

                                          real_inputs,

                                          real_targets,

                                          HEBP_ADD_PATTERN,

                                          0, j);

    }

  }

  fflush(stdout);

}

#endif
 

// USED

// Allocate an array of pointers to neural networks.  This array is global

// (yuck!).  If an array already exists, it and the networks it points to

// are deleted.

void FastAllocateNetworks(int num)

{

  if (real_fast_list!=NULL) {

    for (int i=0; i<real_numNetworks; i++) delete real_fast_list[i];

    delete[] real_fast_list;

  }

  real_fast_list=new FastForwardStruct*[num];

  for (int i=0; i<num; i++) real_fast_list[i]=NULL;

  real_numNetworks=num;

}
 

// USED

// Load a network, and place it in the array created by FastAllocateNetworks

void FastInitNetwork(int num, int numNetworks, char *networkList[])

{

  if (real_fast_list[num]!=NULL) delete real_fast_list[num];

  real_fast_list[num]=FastLoadMerge(numNetworks,networkList);

  FastLoadMergeWeights(real_fast_list[num],numNetworks,networkList);

}
 

#ifndef NoTcl

int FastAllocateNetworksCmd(ClientData data, Tcl_Interp *interp,

                            int argc, char *argv[])

{

  if (argc!=2)

  {

    interp->result="Usage: FastAllocateNetworks <num>";

    return TCL_ERROR;

  }

  FastAllocateNetworks(atoi(argv[1]));

  return TCL_OK;

}
 

int FastInitNetworkCmd(ClientData data, Tcl_Interp *interp,

                       int argc, char *argv[])

{

  if (argc!=3)

  {

    interp->result="Usage: FastInitNetwork <num> <network list>";

    return TCL_ERROR;

  }

  int num=atoi(argv[1]);

  int numNetworks;

  char **networkList;

  Tcl_SplitList(interp,argv[2],&numNetworks,&networkList);

  FastInitNetwork(num,numNetworks,networkList);

  free((char*)networkList);

  return TCL_OK;

}

#endif
 

void FastInit(char *directory, int numNetworks, char *networkList[])

{

  char *olddir=getcwd(NULL,1024);

  chdir(directory);

  real_fast_list=new FastForwardStruct*[numNetworks];

  for (int i=0; i<numNetworks; i++)

  {

    real_fast_list[i]=FastLoadMerge(1,networkList+i);

    FastLoadMergeWeights(real_fast_list[i],1,networkList+i);

    if (i==0)

    {

      real_fast=FastLoadMerge(1,networkList+i);

      FastLoadMergeWeights(real_fast,1,networkList+i);

    }

  }

  chdir(olddir);

  free(olddir);

}
 

#ifndef NoTcl

int FastLoadMergeCmd(ClientData data, Tcl_Interp *interp,

                     int argc, char *argv[])

{

  if (argc!=2)

  {

    interp->result="Usage: FastLoadMerge {network-names}";

    return TCL_ERROR;

  }

  int numNetworks;

  char **networkList;

  if (real_fast_list==NULL) {

    real_fast_list=new FastForwardStruct*[1];

    real_fast_list[0]=NULL;

  }

  Tcl_SplitList(interp,argv[1],&numNetworks,&networkList);

  if (real_fast_list[0]!=NULL) delete real_fast_list[0];

  real_fast_list[0]=FastLoadMerge(numNetworks,networkList);

  free((char*)networkList);

  return TCL_OK;

}

#endif
 

#ifndef NoTcl

int FastLoadMergeWeightsCmd(ClientData data, Tcl_Interp *interp,

                            int argc, char *argv[])

{

  if (argc!=2)

  {

    interp->result="Usage: FastLoadMergeWeights {network-names}";

    return TCL_ERROR;

  }

  int numNetworks;

  char **networkList;

  Tcl_SplitList(interp,argv[1],&numNetworks,&networkList);

  FastLoadMergeWeights(real_fast_list[0],numNetworks,networkList);

  free((char*)networkList);

  return TCL_OK;

}

#endif
 

#ifndef NoTcl

#ifndef NoHEBP

int HEBPInitCmd(ClientData data, Tcl_Interp *interp,

                int argc, char *argv[])

{

  if (argc!=4)

  {

    interp->result="Usage: HEBPInit <directory> {network-names} <needbuf>";

    return TCL_ERROR;

  }

  int numNetworks;

  char **networkList;

  char *dir=argv[1];

  Tcl_SplitList(interp,argv[2],&numNetworks,&networkList);

  int needbuf=atoi(argv[3]);

  HEBPInit(dir,numNetworks,networkList,needbuf);

  free((char*)networkList);

  return TCL_OK;

}

#endif

#endif
 

#ifndef NoTcl

int FastInitCmd(ClientData data, Tcl_Interp *interp,

                int argc, char *argv[])

{

  if (argc!=3)

  {

    interp->result="Usage: FastInit <directory> {network-names}";

    return TCL_ERROR;

  }

  int numNetworks;

  char **networkList;

  char *dir=argv[1];

  Tcl_SplitList(interp,argv[2],&numNetworks,&networkList);

  FastInit(dir,numNetworks,networkList);

  free((char*)networkList);

  return TCL_OK;

}

#endif
 

#ifndef NoTcl

#ifndef NoHEBP

int ReadWeightsCmd(ClientData data, Tcl_Interp *interp,

                   int argc, char *argv[])

{

  if (argc!=3)

  {

    interp->result="Usage: ReadWeights <file> <net>";

    return TCL_OK;

  }

  FILE *inf=fopen(argv[1],"r");

  int net=atoi(argv[2]);

  HEBP_read_weights(real_net+net,real_net[net].conn,inf);

  fclose(inf);

  if (real_fast!=NULL) delete real_fast;

  real_fast=FastConstructForward(real_net);

  if (real_fast_list!=NULL) delete[] real_fast_list;

  real_fast_list=new FastForwardStruct*[real_numNetworks];

  for (int i=0; i<real_numNetworks; i++)

    real_fast_list[i]=FastConstructForward(real_net+i);

  return TCL_OK;

}

#endif
 

#ifndef Test

int FastReadWeightsCmd(ClientData data, Tcl_Interp *interp,

                       int argc, char *argv[])

{

  if (argc!=3)

  {

    interp->result="Usage: FastReadWeights <file> <net>";

    return TCL_OK;

  }

  FILE *inf=fopen(argv[1],"r");

  int net=atoi(argv[2]);

  FastReadWeights(real_fast_list[net],inf);

  fclose(inf);

  return TCL_OK;

}

#endif

#endif
 

#ifndef NoTcl

#ifndef NoHEBP

int WriteWeightsCmd(ClientData data, Tcl_Interp *interp,

                    int argc, char *argv[])

{

  if (argc!=3)

  {

    interp->result="Usage: WriteWeights <file> <net>";

    return TCL_OK;

  }

  FILE *outf=fopen(argv[1],"w");

  int net=atoi(argv[2]);

  HEBP_write_weights(real_net+net,real_net[net].conn,outf);

  fclose(outf);

  return TCL_OK;

}

#endif
 

#ifndef Test

int FastWriteWeightsCmd(ClientData data, Tcl_Interp *interp,

                    int argc, char *argv[])

{

  if (argc!=3)

  {

    interp->result="Usage: FastWriteWeights <file> <net>";

    return TCL_OK;

  }

  FILE *outf=fopen(argv[1],"w");

  int net=atoi(argv[2]);

  FastWriteWeights(real_fast_list[net],outf);

  fclose(outf);

  return TCL_OK;

}

#endif

#endif
 

#ifndef NoTcl

int FastForwardPassCmd(ClientData data, Tcl_Interp *interp,

                       int argc, char *argv[])

{

  if (argc!=2)

  {

    interp->result="Usage: FastForwardPass <net>";

    return TCL_ERROR;

  }

  int net=atoi(argv[1]);

  sprintf(interp->result,"%g",FastForwardPass(real_fast_list[net]));

  return TCL_OK;

}
 

#ifndef Test

int FastWriteActivationsCmd(ClientData data, Tcl_Interp *interp,

                            int argc, char *argv[])

{

  if (argc!=3) {

    interp->result="Usage: FastWriteActivations <net> <file>";

    return TCL_ERROR;

  }

  int net=atoi(argv[1]);

  char *filename=argv[2];

  FastWriteActivations(real_fast_list[net],filename);  

  return TCL_OK;

}
 

int FastReadActivationsCmd(ClientData data, Tcl_Interp *interp,

                            int argc, char *argv[])

{

  if (argc!=3) {

    interp->result="Usage: FastReadActivations <net> <file>";

    return TCL_ERROR;

  }

  int net=atoi(argv[1]);

  char *filename=argv[2];

  FastReadActivations(real_fast_list[net],filename);  

  return TCL_OK;

}

#endif

#endif
 

void MyHebp_InitNoTcl()

{

}
 

#ifndef NoTcl

int MyHebp_Init(Tcl_Interp *interp)

{

#ifndef NoHEBP

  Tcl_CreateCommand(interp,"HEBPInit",HEBPInitCmd,

                    NULL,(Tcl_CmdDeleteProc*)NULL); 

#endif

  Tcl_CreateCommand(interp,"FastInit",FastInitCmd,

                    NULL,(Tcl_CmdDeleteProc*)NULL); 

  Tcl_CreateCommand(interp,"FastLoadMerge",FastLoadMergeCmd,

                    NULL,(Tcl_CmdDeleteProc*)NULL); 

  Tcl_CreateCommand(interp,"FastLoadMergeWeights",FastLoadMergeWeightsCmd,

                    NULL,(Tcl_CmdDeleteProc*)NULL); 

#ifndef NoHEBP

  Tcl_CreateCommand(interp,"ReadWeights",ReadWeightsCmd,

                    NULL,(Tcl_CmdDeleteProc*)NULL);

  Tcl_CreateCommand(interp,"WriteWeights",WriteWeightsCmd,

                    NULL,(Tcl_CmdDeleteProc*)NULL);

#endif

  Tcl_CreateCommand(interp,"TestNetworkSensitivity",

                    TestNetworkSensitivityCmd,

                    NULL,(Tcl_CmdDeleteProc*)NULL);

  Tcl_CreateCommand(interp,"FastAllocateNetworks",

                    FastAllocateNetworksCmd,

                    NULL,(Tcl_CmdDeleteProc*)NULL);

  Tcl_CreateCommand(interp,"FastInitNetwork",

                    FastInitNetworkCmd,

                    NULL,(Tcl_CmdDeleteProc*)NULL);

#ifndef Test

  Tcl_CreateCommand(interp,"FastReadWeights",FastReadWeightsCmd,

                    NULL,(Tcl_CmdDeleteProc*)NULL);

  Tcl_CreateCommand(interp,"FastWriteWeights",FastWriteWeightsCmd,

                    NULL,(Tcl_CmdDeleteProc*)NULL);

  Tcl_CreateCommand(interp,"FastWriteActivations",FastWriteActivationsCmd,

                    NULL,(Tcl_CmdDeleteProc*)NULL);

  Tcl_CreateCommand(interp,"FastReadActivations",FastReadActivationsCmd,

                    NULL,(Tcl_CmdDeleteProc*)NULL);

#endif

  Tcl_CreateCommand(interp,"FastForwardPass",FastForwardPassCmd,

                    NULL,(Tcl_CmdDeleteProc*)NULL);

  Tcl_CreateCommand(interp,"FastRandomizeWeights",FastRandomizeWeightsCmd,

                    NULL,(Tcl_CmdDeleteProc*)NULL);

  return TCL_OK;

}

#endif

Open in new window

0
 

Author Comment

by:dcscy
Comment Utility
Error message:
fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory
#include "stdafx.h"
 

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <malloc.h>

#include <math.h>

#include <sys/types.h>

#ifndef WINNT

#include <time.h>

#include <unistd.h>

#endif
 

//#include <dmedia/vl.h>

//#include <dmedia/vl_vino.h>
 

//#include <X11/X.h>

//#include <X11/Xlib.h>

//#include <X11/Xutil.h>

//#include <X11/keysym.h>

//#include <Xm/MwmUtil.h>
 

//#include <gl/gl.h>
 

#include "maincore.h"

#include "tool.h"

#include "ip.h"
 

extern "C" {

#include "detect.h"

}

//VLBuffer buf = NULL;

int gXsize, gYsize;
 
 

/* global variables */

unsigned char *gpInbuf;

int gWidth, gHeight;

int gLevel;

unsigned char *gpOutbuf;

int *bbuf;

double gEx;

double gEy; 

double gExx;

double gEyy;

double gExy;

double gA11;

double gA12;

double gA22;

double gDet;

int gCount;

int gMode;
 

int gRegionCnt;

RectREC gRect[1000];
 
 

//void drawFrame( VLServer, VLEvent*, void* );

void DetectFace( unsigned char* );

unsigned long *Expansion4( unsigned long*, int, int );

unsigned char *ExtractRegion( unsigned char*, int );

extern BOOL BuildModel( void );

extern void CreateControlPanel( int, char** );
 

#ifdef notdef

void main( int argc, char **argv )

{
 

  if( fork()== 0 )

    CreateControlPanel( argc, argv );
 

  BuildModel();

 

//  Display *dpy;

  VLControlValue val;

//  int x, y;

//  unsigned int  w, h, bw, d;

//  Window dummyWin;
 

//  dpy = XOpenDisplay("");
 

  VLServer svr = vlOpenVideo( "" );
 

#if 0

  Window vwin = XCreateSimpleWindow( dpy, RootWindow(dpy, 0), 

			 10, 10, 312, 214, 0, 

			 BlackPixel( dpy, DefaultScreen(dpy) ),

		         BlackPixel( dpy, DefaultScreen(dpy) ) );

  XMapWindow( dpy, vwin );

  XFlush( dpy );

#endif
 

  VLNode src = vlGetNode( svr, VL_SRC, VL_VIDEO, VL_ANY ); 

  VLNode drn = vlGetNode( svr, VL_DRN, VL_MEM, VL_ANY ); 
 

#if 0

  VLDevList devlist;

  int count = vlGetDeviceList( svr, &devlist ); 

  printf( "count = %d\n", count );

#endif
 

  VLPath path;

  if((path = vlCreatePath( svr, VL_ANY, src, drn )) < 0) {

    printf( "path = %d\n", path );

    exit(1);

  }
 

  vlSetupPaths( svr, (VLPathList)&path, 1, VL_SHARE, VL_SHARE );

  

  val.intVal = VL_PACKING_RGB_8;

  vlSetControl( svr, path, drn, VL_PACKING, &val );
 

  vlGetControl( svr, path, drn, VL_SIZE, &val );

  gXsize = val.xyVal.x;

  gYsize = val.xyVal.y;
 

  prefsize( gXsize, gYsize );

  long win = winopen( "Sample" );

  RGBmode();

  pixmode( PM_TTOB, 1 );

  gconfig();
 

printf( "gXsize = %d, gYsize = %d\n", gXsize, gYsize );
 

#if 0

  val.intVal = vwin;

  vlSetControl( svr, path, drn, VL_WINDOW, &val );
 

  XTranslateCoordinates( dpy, vwin, RootWindow( dpy, DefaultScreen(dpy) ),

			     0, 0, &x, &y, &dummyWin );
 

  val.xyVal.x = x;

  val.xyVal.y = y;

  vlSetControl( svr, path, drn, VL_ORIGIN, &val );

  XGetGeometry( dpy, vwin, &dummyWin, &x, &y, &w, &h, &bw, &d );

  val.xyVal.x = w;

  val.xyVal.y = h;

  vlSetControl( svr, path, drn, VL_SIZE, &val );
 

#endif
 

  buf = vlCreateBuffer( svr, path, drn, 10);

  vlRegisterBuffer( svr, path, drn, buf );

  int mask = VLTransferCompleteMask | 

                         VLStreamPreemptedMask | VLTransferFailedMask;

  vlSelectEvents( svr, path, mask );

  vlAddCallback( svr, path, mask, drawFrame, NULL );

  

  vlBeginTransfer( svr, path, 0, NULL );
 

 vlMainLoop();
 
 

#if 0

  VLInfoPtr info;

  unsigned char *dataPtr, *lastdataPtr = NULL;
 

int icount = 0;
 

  while(1){

    while (info = vlGetLatestValid( svr, buf )) {
 

	dataPtr = (unsigned char*)vlGetActiveRegion( svr, buf, info );
 

#if 0

icount++;

if( icount==20 ) {

  unsigned char *buf = (unsigned char*)malloc( gXsize*gYsize*3 );

  for( int i=0; i<gXsize*gYsize; i++ ) {

      *(buf+i*3) = *(dataPtr+i*4+3);

      *(buf+i*3+1) = *(dataPtr+i*4+2);

      *(buf+i*3+2) = *(dataPtr+i*4+1);

  }

  writeim( buf, gXsize, gYsize, 255, "xxx.xxx" ); 

  free( buf );

}

#endif
 

	DetectFace( dataPtr );
 

        //	lrectwrite(0, 0, gXsize-1, gYsize-1, (ulong*)dataPtr);

	vlPutFree( svr, buf );
 

    }

  }

#endif
 
 

  vlEndTransfer( svr, path );

  vlDestroyPath( svr, path );

  vlCloseVideo( svr );
 

}

#endif
 

void SelectWork( void )

{

} 
 

#ifdef sparc

#ifndef solaris

#ifndef WINNT

extern "C" {

int gettimeofday(struct timeval *tp, struct timezone *tzp);

}

#endif

#endif

#endif
 

#ifndef WINNT

struct timeval *StartTimer( void )

{

  struct timeval *stimer = (struct timeval*)malloc( sizeof(struct timeval) );

  gettimeofday( stimer ,NULL);

  return stimer;

}
 

void StopTimer( char *str, struct timeval *stime )

{

  struct timeval thistime;

  gettimeofday(&thistime,NULL);

  double diff=1e-6*(thistime.tv_usec-stime->tv_usec)+

    (thistime.tv_sec-stime->tv_sec);

  //  fprintf( stderr, str );

  //  fprintf(stderr,"     FPS=%.3f  SPF=%.3f\n",1.0/diff,diff);

  free( stime );

}

#endif
 

#ifdef notdef

void drawFrame( VLServer svr, VLEvent *ev, void *data )

{

  static int count = 0;
 

  VLInfoPtr info;

  char *dataPtr, *lastdataPtr = NULL;
 

  if( gMode&MOD_EXIT )

    exit(1);
 
 

  switch( ev->reason )

  {

	case VLTransferComplete:

           while (info = vlGetLatestValid( svr, buf )) {

	     dataPtr = (unsigned char*)vlGetActiveRegion( svr, buf, info );

	     DetectFace( dataPtr );

             //	     lrectwrite(0, 0, gXsize-1, gYsize-1, (ulong*)dataPtr);
 

#if 0

linewidth( 10 );
 

     for( int i=0; i<gRegionCnt; i++ ) {

        int x1 = gRect[i].sx*2;

        int x2 = gRect[i].ex*2;

        int y1 = gRect[i].sy*2;

        int y2 = gRect[i].ey*2;
 
 

printf( "%d  %d  %d  %d\n", x1, x2, y1, y2 );
 

	int vector1[2] = { x1, y1 };

	int vector2[2] = { x2, y1 };

	int vector3[2] = { x2, y2 };

	int vector4[2] = { x1, y2 };
 

	bgnclosedline();

	v2i( vector1 );

	v2i( vector2 );

	v2i( vector3 );

	v2i( vector4 );

	endclosedline();

    }

#endif
 

#if 0

	   count++;

	   if( count > 10 )

	     exit(2);

#endif

	     vlPutFree( svr, buf );

	   }

	break;

   }

}	

#endif
 

void DetectFace( unsigned char *pInbuf )

{

#ifndef WINNT

    struct timeval *timer0 = StartTimer();

#endif
 

    int i, j, tmp, tmp1, tmp2, tmp3, tmp4;

    int delta;

    unsigned int ct, sum, size;

    unsigned char r, g;

    double xEx, yEy;

    unsigned char *ptr;

    unsigned char *ptrct, *endptr;

    unsigned long  *pWorkBuf, *pWorkBuf2;

    int width = (gXsize+1)/2, height = (gYsize+1)/2;

//    int width = gXsize, height = gYsize, level;

    char name[STRSIZE];

 

//    if( (pInbuf = readim( &width, &height, &level, pFname )) == NULL )

//        return FALSE;
 

    size = width*height;

    pWorkBuf = (unsigned long*)calloc( sizeof(unsigned long), size );
 

//    pWorkBuf2 = (unsigned long*)calloc( sizeof(unsigned long), size );
 

    delta = gXsize*4;

    ptr = pInbuf;

    endptr = ptr+delta*gYsize;

    ptrct = ptr+delta;
 

#if 0

static double Ex=0;

static double Ey=0; 

static double Exx=0;

static double Eyy=0;

static double Exy=0;

static int count=0;

#endif 
 
 
 
 

#ifndef WINNT

    struct timeval *timer = StartTimer();

#endif
 

    i = 0;

    while( ptr<endptr ) {

       for( ; ptr<ptrct; ptr+=8, i++ ) {

            sum = ( r = *(ptr+3) ) + ( g = *(ptr+2) ) + *(ptr+1);

            if( sum < 50 )

                continue;

            xEx = ((double)r)/sum - gEx;

            yEy = ((double)g)/sum - gEy;

            if( xEx*(xEx*gA22-yEy*gA12)+yEy*yEy<gDet ) {

                *(pWorkBuf+i) = 1;
 

#if 0

		  double dr = ((double)r)/sum;

		  double dg = ((double)g)/sum;

		  Ex += dr;

		  Ey += dg;

		  Exx += dr*dr;

		  Eyy += dg*dg;

		  Exy += dr*dg;

		  count++;

#endif

	      }

	  }

       ptr = ptrct+delta;

       ptrct = ptr+delta;

    }

#ifndef WINNT

    StopTimer( "\nSkinColor", timer );

#endif

                                                // adjust covariance

#if 0

    if( count > 50000 ) {

#if 1

      gEx = gEx*2/3 + Ex/count/3;

      gEy = gEy*2/3 + Ey/count/3;

      gExx = gExx*2/3 + Exx/count/3;

      gEyy =gEyy*2/3 + Eyy/count/3;

      gExy =gExy*2/3 + Exy/count/3;

      gA11 = gExx-gEx*gEx;

      gA12 = gExy-gEx*gEy;

      gA22 = gEyy-gEy*gEy;

      gDet = 2*(gA11*gA22-gA12*gA12);

#else

      gEx = Ex/count;

      gEy = Ey/count;

      gExx = Exx/count;

      gEyy = Eyy/count;

      gExy = Exy/count;

      gA11 = gExx-gEx*gEx;

      gA12 = gExy-gEx*gEy;

      gA22 = gEyy-gEy*gEy;

      gDet = 2*(gA11*gA22-gA12*gA12);

#endif

      gA12 = 2*gA12/gA11;

      gA22 /= gA11;

      gDet /= gA11;

    printf( "count = %d\n", count );

    printf( "gEx = %f\n", gEx );

    printf( "gEy = %f\n", gEy );

    printf( "gExx = %f\n", gExx );

    printf( "gEyy = %f\n", gEyy );

    printf( "gExy = %f\n",gExy );

      Ex=0;

      Ey=0; 

      Exx=0;

      Eyy=0;

      Exy=0;

      count=0;

    }

#endif
 

    pWorkBuf = Expansion4( pWorkBuf, width, height );
 

    ClassfyImage( pWorkBuf, width, height );
 

#if 0

  int numFaces   ;

  struct FaceLocation *locArray;

  unsigned char *pBuf = (unsigned char*)malloc( gXsize*gYsize );

  for( i=0; i<gXsize*gYsize; i++ ) {

    unsigned char *tmp = pInbuf+i*4+1;

    *(pBuf+i) = 0.299*(*(tmp+2))+0.587*(*(tmp+1))+0.114*(*tmp);

  }

  free( pBuf );			      

    //  numFaces = Xavier_FindAllFaces( gXsize, gYsize, pBuf, &locArray );

  if(numFaces==0) 

    fprintf(stderr,"No faces found.\n");

  else

  {

    fprintf(stderr,"%d faces found:\n",numFaces);

    for (i=0; i<numFaces; i++) {

      fprintf(stderr,"  (%d,%d)-(%d,%d)\n",

              locArray[i].x1,locArray[i].y1,

              locArray[i].x2,locArray[i].y2);

    }

    free( (char*)locArray );

  }

#endif
 

#if 1

    int numFaces;

    struct FaceLocation *locArray=NULL;

    for( i=0; i<gRegionCnt; i++ ) {

      unsigned char *pBuf = ExtractRegion( pInbuf, i );

      int xsize = (gRect[i].ex-gRect[i].sx+1)*2;

      int ysize = (gRect[i].ey-gRect[i].sy+1)*2;
 

#ifndef WINNT

      struct timeval *timer = StartTimer();

#endif

      numFaces = Xavier_FindAllFaces( xsize, ysize, pBuf, &locArray );

#ifndef WINNT

      StopTimer( "NeuralNetwork", timer );

#endif
 

      fprintf(stderr,"%d faces found:\n",numFaces);

      for (int ii=0; ii<numFaces; ii++) {

	fprintf(stderr,"  (%d,%d)-(%d,%d)\n",

		locArray[ii].x1,locArray[ii].y1,

		locArray[ii].x2,locArray[ii].y2);

      }
 

      int tmp0 = gRect[i].sy*2*gXsize + gRect[i].sx*2;

      for( int k=0; k<numFaces; k++ ) { 

	tmp1 = tmp0 + locArray[k].y1*gXsize + locArray[k].x1;

	tmp2 = tmp0 + locArray[k].y1*gXsize + locArray[k].x2;

	tmp3 = tmp0 + locArray[k].y2*gXsize + locArray[k].x1;

	tmp4 = tmp0 + locArray[k].y2*gXsize + locArray[k].x2;
 

	unsigned char *pTmp;

	for( pTmp=pInbuf+tmp1*4; pTmp<=pInbuf+tmp2*4; pTmp+=4 ) {

	  *(pTmp+1) = 0;

	  *(pTmp+2) = 0xFF;

	  *(pTmp+3) = 0;

	}

	for( pTmp=pInbuf+tmp3*4; pTmp<=pInbuf+tmp4*4; pTmp+=4 ) {

	  *(pTmp+1) = 0;

	  *(pTmp+2) = 0xFF;

	  *(pTmp+3) = 0;

	}

	for( pTmp=pInbuf+tmp1*4; pTmp<=pInbuf+tmp3*4; pTmp+=(4*gXsize) ) {

	  *(pTmp+1) = 0;

	  *(pTmp+2) = 0xFF;

	  *(pTmp+3) = 0;

	}

	for( pTmp=pInbuf+tmp2*4; pTmp<=pInbuf+tmp4*4; pTmp+=(4*gXsize) ) {

	  *(pTmp+1) = 0;

	  *(pTmp+2) = 0xFF;

	  *(pTmp+3) = 0;

	}

      }

      if( locArray ) {

	free( (char*)locArray );

	locArray = NULL;

      }

      free( pBuf );

    }

#endif
 

#if 1

    for( i=0; i<gRegionCnt; i++ ) {

        tmp1 = gRect[i].sy*gXsize*2 + gRect[i].sx*2;

        tmp2 = gRect[i].sy*gXsize*2 + gRect[i].ex*2;

        tmp3 = gRect[i].ey*gXsize*2 + gRect[i].sx*2;

        tmp4 = gRect[i].ey*gXsize*2 + gRect[i].ex*2;
 

	unsigned char *pTmp;

	for( pTmp=pInbuf+tmp1*4; pTmp<=pInbuf+tmp2*4; pTmp+=4 ) {

	    *(pTmp+1) = 0;

	    *(pTmp+3) = 0xFF;

            *(pTmp+2) = 0;

	}

	for( pTmp=pInbuf+tmp3*4; pTmp<=pInbuf+tmp4*4; pTmp+=4 ) {

	    *(pTmp+1) = 0;

	    *(pTmp+3) = 0xFF;

            *(pTmp+2) = 0;

	}

	for( pTmp=pInbuf+tmp1*4; pTmp<=pInbuf+tmp3*4; pTmp+=(4*gXsize) ) {

	    *(pTmp+1) = 0;

	    *(pTmp+3) = 0xFF;

            *(pTmp+2) = 0;

        }

	for( pTmp=pInbuf+tmp2*4; pTmp<=pInbuf+tmp4*4; pTmp+=(4*gXsize) ) {

	    *(pTmp+1) = 0;

	    *(pTmp+3) = 0xFF;

            *(pTmp+2) = 0;

        }

     }

#endif
 

//  free( pInbuf );

    free( pWorkBuf );

//  free( pWorkBuf2 );
 

#ifndef WINNT

    StopTimer( "DetectFace", timer0 );

#endif

}
 

unsigned char *ExtractRegion( unsigned char *pInbuf, int num )

{

#ifndef WINNT

  struct timeval *timer = StartTimer();

#endif
 

  int xsize = (gRect[num].ex-gRect[num].sx+1)*2;

  int ysize = (gRect[num].ey-gRect[num].sy+1)*2;
 

  unsigned char *pBuf = (unsigned char*)malloc( xsize*ysize );

  unsigned char *ptr;

  int tmp = gRect[num].sy*2*gXsize + gRect[num].sx*2;

  int delta = (gXsize-xsize)*4;

  int i=0;

  for( ptr=pInbuf+tmp*4; i<xsize*ysize; ptr+=delta ) {

    for( int j=0; j<xsize; i++, j++, ptr+=4 ) {

	*(pBuf+i) = (unsigned char)

          (0.299*(*(ptr+3))+0.587*(*(ptr+2))+0.114*(*(ptr+1)));

//	*(pBuf+i) = *(ptr+2);

      }

  }
 

#ifndef WINNT

  StopTimer( "ExtractRecgion", timer );

#endif

  return pBuf;

}
 

// USED

// Given a binary image, return a new image such that for each active

// pixel in the input, that pixel's 8 neighbors are also active in the

// new image.

unsigned long *Expansion4( unsigned long *pInbuf, int width, int height )

{

#ifndef WINNT

  struct timeval *timer = StartTimer();

#endif
 

    int i, j;

    unsigned long *pBuf, *pCur = pInbuf;

    unsigned long *pPtr1, *pPtr2, *pPtr3;
 

    pBuf = (unsigned long*)calloc( sizeof(unsigned long), width*height );
 

    pPtr2 = pBuf;

    pPtr3 = pPtr2 + width;
 

    if( *pCur ) {

        *pPtr2 = 1;

	*pPtr3 = 1;

        *( pPtr2 + 1 )= 1;

	*( pPtr3 + 1 )= 1;

    }

    for( j=1; j<width-1; j++ ) {

        if( *(++pCur) ) {

           *pPtr2 = 1;

	   *pPtr3 = 1;

	   *(++pPtr2) = 1;

	   *(++pPtr3) = 1;

	   *( pPtr2 + 1 )= 1;

	   *( pPtr3 + 1 )= 1;

	}

	else {

	  pPtr2++;

	  pPtr3++;

	}

    }

    if( *(++pCur) ) {

        *pPtr2 = 1;

	*pPtr3 = 1;

        *(++pPtr2) = 1;

	*(++pPtr3) = 1;

	pPtr2++;

	pPtr3++;

    }

    else {

	pPtr2 += 2;

	pPtr3 += 2;

    }

	

    pPtr1 = pBuf;

    for( i=1; i<height-1; i++ ) {

        if( *(++pCur) ) {

	    *pPtr1 = 1;

	    *pPtr2 = 1;

	    *pPtr3 = 1;

	    *( pPtr1 + 1 )= 1;

	    *( pPtr2 + 1 )= 1;

	    *( pPtr3 + 1 )= 1;

 	}

        for( j=1; j<width-1; j++ ) {

	    if( *(++pCur) ) {

	      *pPtr1 = 1;

	      *pPtr2 = 1;

	      *pPtr3 = 1;

	      *(++pPtr1) = 1;

	      *(++pPtr2) = 1;

	      *(++pPtr3) = 1;

	      *( pPtr1 + 1 )= 1;

	      *( pPtr2 + 1 )= 1;

	      *( pPtr3 + 1 )= 1;

	    }

	    else {

	      pPtr1++;

	      pPtr2++;

	      pPtr3++;

	    }

	}

	if( *(++pCur) ) {

	    *pPtr1 = 1;

	    *pPtr2 = 1;

	    *pPtr3 = 1;

	    *(++pPtr1) = 1;

	    *(++pPtr2) = 1;

	    *(++pPtr3) = 1;

	    pPtr1++;

	    pPtr2++;

	    pPtr3++;

	}

	else {

	  pPtr1 += 2;

	  pPtr2 += 2;

	  pPtr3 += 2;

	}

    }
 

    if( *(++pCur) ) {

        *pPtr1 = 1;

	*pPtr2 = 1;

        *( pPtr1 + 1 )= 1;

	*( pPtr2 + 1 )= 1;

    }

    for( j=1; j<width-1; j++ ) {

        if( *(++pCur) ) {

           *pPtr1 = 1;

	   *pPtr2 = 1;

	   *(++pPtr1) = 1;

	   *(++pPtr2) = 1;

	   *( pPtr1 + 1 )= 1;

	   *( pPtr2 + 1 )= 1;

	}

	else {

	  pPtr1++;

	  pPtr2++;

	}

    }

    if( *(++pCur) ) {

        *pPtr1 = 1;

	*pPtr2 = 1;

        *(++pPtr1) = 1;

	*(++pPtr2) = 1;

    }
 

    free( pInbuf );
 

#ifndef WINNT

    StopTimer( "Expansion", timer );

#endif

    return pBuf;

}

Open in new window

0
 
LVL 53

Expert Comment

by:Infinity08
Comment Utility
What if you add these two defines right before including the header file ?

        #define NoTcl
        #define NoVista

(instead of the DNoVista;DNoTcl;). If that gives you the same problem, can you show the errors you get ?
0
 
LVL 53

Accepted Solution

by:
Infinity08 earned 50 total points
Comment Utility
>> Cannot open include file: 'unistd.h': No such file or directory

That means that WINNT isn't defined ...

        #ifndef WINNT
        #include <unistd.h>
        }
        #endif

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
One of Google's most recent algorithm changes affecting local searches is entitled "The Pigeon Update." This update has dramatically enhanced search inquires for the keyword "Yelp." Google searches with the word "Yelp" included will now yield Yelp a…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now