What is wrong with this C++ Code ?
- by mr.bio
Hi .. i am a beginner and i have a problem :
this code doesnt compile :
main.cpp:
#include <stdlib.h>
#include "readdir.h"
#include "mysql.h"
#include "readimage.h"
int main(int argc, char** argv) {
if (argc>1){
readdir(argv[1]);
// test();
return (EXIT_SUCCESS);
}
std::cout << "Bitte Pfad angeben !" << std::endl ;
return (EXIT_FAILURE);
}
readimage.cpp
#include <Magick++.h>
#include <iostream>
#include <vector>
using namespace Magick; using namespace std;
void readImage(std::vector<string> &filenames) {
for (unsigned int i = 0; i < filenames.size(); ++i) {
try {
Image img("binary/" + filenames.at(i));
for (unsigned int y = 1; y < img.rows(); y++) {
for (unsigned int x = 1; x < img.columns(); x++) {
ColorRGB rgb(img.pixelColor(x, y));
// cout << "x: " << x << " y: " << y << " : " << rgb.red() << endl;
}
}
cout << "done " << i << endl;
} catch (Magick::Exception & error) {
cerr << "Caught Magick++ exception: " << error.what() << endl;
}
} }
readimage.h
#ifndef _READIMAGE_H
#define _READIMAGE_H
#include <Magick++.h>
#include <iostream>
#include <vector>
#include <string>
using namespace Magick;
using namespace std;
void readImage(vector<string> &filenames)
#endif /* _READIMAGE_H */
If want to compile it with this code :
g++ main.cpp Magick++-config --cflags
--cppflags --ldflags --libs readimage.cpp
i get this error message :
main.cpp:5: error: expected
initializer before ‘int’
i have no clue , why ? :(
Can somebody help me ? :)