Answered by:
error C4430: missing type specifier  int assumed. Note: C++ does not support defaultint
,
>

I'm working on VS2008/C++ and I got that error and I couldn't solve it.
This is my source code..
SimilarityCalculator.cpp:
#include "StdAfx.h" #include <iostream> #include "SimilarityCalculator.h" using namespace std; int ind; double mu,delta; SimilarityCalculator::SimilarityCalculator(void) { } SimilarityCalculator::~SimilarityCalculator(void) { } SimilarityCalculator::get_similarity(float mu, float delta, char* seq_a, char* seq_b, int N_max) { int N_a = strlen(seq_a); // get the actual lengths of the sequences int N_b = strlen(seq_b); //////////////////////////////////////////////// // allocate space for H double **H; H = new double *[N_a+1]; for( int i = 0 ; i < N_a+1 ; i++ ) H[i] = new double[N_b+1]; // initialize H for(int i=0;i<=N_a;i++) { for(int j=0;j<=N_b;j++) { H[i][j]=0.; } } double temp[4]; //allocate space for I_i & I_j int **I_i, **I_j; // Index matrices to remember the 'path' for backtracking I_i = new int *[N_a+1]; for( int i = 0 ; i < N_a+1 ; i++ ) I_i[i] = new int[N_b+1]; I_j = new int *[N_a+1]; for( int i = 0 ; i < N_a+1 ; i++ ) I_j[i] = new int[N_b+1]; // here comes the actual algorithm for(int i=1;i<=N_a;i++) { for(int j=1;j<=N_b;j++) { double res = 0; if(seq_a[i1] == seq_b[j1]) res = 1.; else res = mu; //temp[0] = H[i1][j1] + similarity_score(seq_a[i1],seq_b[j1]); temp[0] = H[i1][j1] + res; temp[1] = H[i1][j]  delta; temp[2] = H[i][j1]  delta; temp[3] = 0.; //H[i][j] = find_array_max(temp,4); double max = temp[0]; // start with max = first element ind = 0; for(int k = 1; k<4; k++){ if(temp[k] > max){ max = temp[k]; ind = k; } } H[i][j] = max; switch(ind){ case 0: // score in (i,j) stems from a match/mismatch I_i[i][j] = i1; I_j[i][j] = j1; break; case 1: // score in (i,j) stems from a deletion in sequence A I_i[i][j] = i1; I_j[i][j] = j; break; case 2: // score in (i,j) stems from a deletion in sequence B I_i[i][j] = i; I_j[i][j] = j1; break; case 3: // (i,j) is the beginning of a subsequence I_i[i][j] = i; I_j[i][j] = j; break; } } } // Print the matrix H to the console cout<<"**********************************************"<<endl; cout<<"The scoring matrix is given by "<<endl<<endl; for(int i=1;i<=N_a;i++) { for(int j=1;j<=N_b;j++) { cout<<H[i][j]<<" "; } cout<<endl; } // search H for the maximal score double H_max = 0.; int i_max=0,j_max=0; for(int i=1;i<=N_a;i++) { for(int j=1;j<=N_b;j++) { if(H[i][j]>H_max){ H_max = H[i][j]; i_max = i; j_max = j; } } } //cout<<H_max<<endl; // Backtracking from H_max int current_i=i_max,current_j=j_max; int next_i=I_i[current_i][current_j]; int next_j=I_j[current_i][current_j]; int tick=0; char *consensus_a, *consensus_b; consensus_a = new char[N_a+N_b+2]; consensus_b = new char[N_a+N_b+2]; while(((current_i!=next_i)  (current_j!=next_j)) && (next_j!=0) && (next_i!=0)) { if(next_i==current_i) consensus_a[tick] = ''; // deletion in A else consensus_a[tick] = seq_a[current_i1]; // match/mismatch in A if(next_j==current_j) consensus_b[tick] = ''; // deletion in B else consensus_b[tick] = seq_b[current_j1]; // match/mismatch in B current_i = next_i; current_j = next_j; next_i = I_i[current_i][current_j]; next_j = I_j[current_i][current_j]; tick++; } // Output of the consensus motif to the console cout<<endl<<"***********************************************"<<endl; cout<<"The alignment of the sequences"<<endl<<endl; for(int i=0;i<N_a;i++){cout<<seq_a[i];}; cout<<" and"<<endl; for(int i=0;i<N_b;i++){cout<<seq_b[i];}; cout<<endl<<endl; cout<<"is for the parameters mu = "<<mu<<" and delta = "<<delta<<" given by"<<endl<<endl; for(int i=tick1;i>=0;i) cout<<consensus_a[i]; cout<<endl; for(int j=tick1;j>=0;j) cout<<consensus_b[j]; cout<<endl; // return 0; }
SimilarityCalculator.h:
#pragma once class SimilarityCalculator { public: SimilarityCalculator(void); ~SimilarityCalculator(void); int get_similarity(float mu, float delta, char* seq_a, char* seq_b, int N_max); };
and This is the main function:
#include "stdafx.h" #include "SimilarityCalculator.h" int main(int argc, char* argv[]) { SimilarityCalculator SimCalc; SimCalc.get_similarity(1, 1, "aaa", "bbb", 10); return 0; }
The error appears in SimilarityCalculator.cpp at this line:
SimilarityCalculator::get_similarity(float mu, float delta, char* seq_a, char* seq_b, int N_max) {
Thanks in advance..
Question
Answers

You forgot to put "int" in front of
SimilarityCalculator::get_similarity Marked as answer by Islam Abdo Saturday, August 01, 2009 12:30 AM
All replies

You forgot to put "int" in front of
SimilarityCalculator::get_similarity Marked as answer by Islam Abdo Saturday, August 01, 2009 12:30 AM


I have the same problem
#include "StdAfx.h"
#include<iostream>
using namespace std;
main()
{ // here is the problem and I don't understand why
int nbre_heritiers;
float heritage, part;
cout<<"Quel est le nombre d'heritiers? ";
cin>>nbre_heritiers;
cout<<"Quel est le montant de l'heritage? ";
cin>>heritage;
part=heritage/nbre_heritiers;
cout<<"Chaque heritier reçoit "<< part << endl;
} 