Command line arguments problem
I'm working on a project for my Computer Science class and I'm having a problem taking in these command line arguments.
I get the error
bash-3.00$ g++ water.cpp
water.cpp: In function `int main(int, char**)':
water.cpp:28: error: invalid conversion from `Config*' to `int'
water.cpp:28: error: initializing argument 1 of `Config::Config(int)'
water.cpp:29: error: invalid conversion from `Config*' to `int'
water.cpp:29: error: initializing argument 1 of `Config::Config(int)'
What is going on??
Code below:
main:
#include <iostream>
#include "Solver.h"
#include "Water.h"
#include "Config.h"
#include <list>
using namespace std;
int main( int argc, char* argv[] ) {
Solver s;
list<Config> initialConfigs;
list<Config> maxConfigs;
Config goal( atoi( argv[1] ) );
for( int i = 2; i != argc; i++ ) {
int temp = atoi( argv[i] );
initialConfigs.push_front( new Config( 0 ) );
maxConfigs.push_front( new Config( temp ) );
}
Water* w = new Water( initialConfigs, maxConfigs, goal);
And my config class is:
#ifndef CONFIG_H
#define CONFIG_H
class Config {
public:
Config( int init );
int getConfig();
void setConfig( int init );
bool isEqual( Config *c );
private:
int _init;
};
#endif

