I am trying to compile the below code using "g++ main.cpp -c" but it gives me this strange error .. any ideas?
main.cpp: In function ‘int main()’:
main.cpp:9:17: error: invalid conversion from ‘Graph*’ to ‘int’
main.cpp:9:17: error: initializing argument 1 of ‘Graph::Graph(int)’
main.cpp:10:16: warning: deprecated conversion from string constant to ‘char*’
This is my main module which i am trying to compile and below that is the graph class i have in graph.hpp
#include <iostream>
#include "graph.hpp"
using namespace std;
int main()
{
Graph g;
g = new Graph();
char* path = "graph.csv";
g.createGraph(path);
return 0;
}
AND this is my Graph class
/*
* graph.hpp
*
* Created on: Jan 28, 2012
* Author: ajinkya
*/
#ifndef _GRAPH_HPP_
#define _GRAPH_HPP_
#include "street.hpp"
#include "isection.hpp"
#include <vector>
class Graph
{
public:
Graph(const int vertexCount = 0);
//void addIsection(Isection is);
//void removeIsection(int iSectionId);
Isection* findIsection(int);
void addStreet(int iSection1, int iSection2, int weight);
void createGraph(const char *path); //uses adj matrix stored in a flat file
//void removeStreet(int streetID);
void printGraph();
~Graph();
private:
//Isection *parkingLot;
//Isection *freeWay;
int** adjMatrix;
std::vector <Street*> edgeList;
std::vector <Isection*> nodeList;
int vertexCount;
};
#endif