我编译了一个c tidy程序,我收到一个错误,这是他们给出的示例程序
#include "tidy/tidy.h"
#include <stdio.h>
#include <errno.h>
int main(int argc, char **argv )
{
const char* input = "<title>Foo</title><p>Foo!";
TidyBuffer output = {0};
TidyBuffer errbuf = {0};
int rc = -1;
Bool ok;
TidyDoc tdoc = tidyCreate(); // Initialize "document"
printf( "Tidying:\t%s\n", input );
ok = tidyOptSetBool( tdoc, TidyXhtmlOut, yes ); // Convert to XHTML
if ( ok )
rc = tidySetErrorBuffer( tdoc, &errbuf ); // Capture diagnostics
if ( rc >= 0 )
rc = tidyParseString( tdoc, input …
Run Code Online (Sandbox Code Playgroud) 我只有一个头文件和一个.cpp文件,我只是将值传递给函数,但它给了我一个错误
main.c中
#include "me.h"
#include <iostream>
#include <sstream>
#include <string.h>
using namespace std;
int main()
{
me("http");
}
Run Code Online (Sandbox Code Playgroud)
me.h
#ifndef ME_H_
#define ME_H_
#include <string.h>
class me {
public:
me(std::string u);
virtual ~me();
};
#endif /* ME_H_ */
Run Code Online (Sandbox Code Playgroud)
me.cpp
#include "me.h"
#include <iostream>
#include <string.h>
using namespace std;
me::me(std::string u) {
// TODO Auto-generated constructor stub
cout << "help";
}
me::~me() {
// TODO Auto-generated destructor stub
}
Run Code Online (Sandbox Code Playgroud)
我收到了一个错误
In file included from ../src/me.cpp:8:
../src/me.h:13: error: expected ‘)’ before ‘u’ …
Run Code Online (Sandbox Code Playgroud)