Unable to start program ....\Final.exe The system cannot find the file specified!

Hello,

I am very new to C++, I am trying to make use of an existed class, So I have created my main method and trying to call the code existed using the header file and a method call..

The code is attached.

I think I have a linking error, cz I am not calling the method in a right way.

Thank you in advance

Wiz

(((Adapters.h)))
#include "stdafx.h"
#include <iostream>
#ifndef ADAPTERS_H
#define ADAPTERS_H

class Adapters {
public:
Adapters();
~Adapters();
int displayAdapters();

}

#endif
................................................................



(((Adapters.cpp)))
#include "stdafx.h"
#include <pcap.h>
#include "Adapters.h"

using namespace std;

/*

void Adapters::Adapters()
{
}

void Adapters::~Adapters()
{
} */

int Adapters::displayAdapters()
{
pcap_if_t * allAdapters;
pcap_if_t * adapter;
char errorBuffer[ PCAP_ERRBUF_SIZE ];

// retrieve the adapters from the computer
if( pcap_findalldevs_ex( PCAP_SRC_IF_STRING, NULL,
&allAdapters, errorBuffer ) == -1 )

{
fprintf( stderr, "Error in pcap_findalldevs_ex function: %s\n",
errorBuffer );
return -1;
}

// if there are no adapters, print an error
if( allAdapters == NULL )
{
printf( "\nNo adapters found! Make sure WinPcap is installed.\n" );
return 0;
}

// print the list of adapters along with basic information about an adapter
int crtAdapter = 0;
for( adapter = allAdapters; adapter != NULL; adapter = adapter->next)
{
printf( "\n%d.%s ", ++crtAdapter, adapter->name );
printf( "-- %s\n", adapter->description );
}

printf( "\n" );

// free the adapter list
pcap_freealldevs( allAdapters );

system( "PAUSE" );
return 0;
}
..............................................................

(((Final.cpp)))
#include "stdafx.h"
#include <iostream>
#include "Adapters.h"

using namespace std;

Adapters *Adapt;
int main ()


{

Adapt = new Adapters();
Adapt->displayAdapters();

delete Adapt;


}

...............................................................

(((Final.h)))
#include <iostream>

#ifndef FINAL_H
#define FINAL_H
#include "Adapters.h"
#endif
If you have linker errrors you probably have to add a library to your project.
Topic archived. No new replies allowed.