I have been at this for weeks and I am able to get most of the errors cleared on my own. I am stuck on these errors and I am unable to find out what is really wrong and going on. I am still pretty new at this. The code I have is listed below. Where the error is located at is at mysql_field. It is throwing a C2447 '{': missing function header(old-style format list?). I have three of these errors.

#include "field_types.h"
#include "my_list.h"
#include "mysql_com.h"

/* Include declarations of plug-in API */
#include "mysql/client_plugin.h"  // IWYU pragma: keep

/*
  The client should be able to know which version it is compiled against,
  even if mysql.h doesn't use this information directly.
*/
#include "mysql_version.h"  // IWYU pragma: keep

// MYSQL_TIME is part of our public API.
#include "mysql_time.h"  // IWYU pragma: keep

// The error messages are part of our public API.
#include "errmsg.h"  // IWYU pragma: keep

#ifdef __cplusplus
extern "C"
#endif
#include <mysql.h>

namespace MySQL {
extern signed int mysql_port;
};
extern char* mysql_unix_port;

#define CLIENT_NET_RETRY_COUNT 1                 /* Retry count */
#define CLIENT_NET_READ_TIMEOUT 365 * 24 * 3600  /* Timeout on read */
#define CLIENT_NET_WRITE_TIMEOUT 365 * 24 * 3600 /* Timeout on write */

#define IS_PRI_KEY(n) ((n)&PRI_KEY_FLAG)
#define IS_NOT_NULL(n) ((n)&NOT_NULL_FLAG)
#define IS_BLOB(n) ((n)&BLOB_FLAG)
/**
Returns true if the value is a number which does not need quotes for
the sql_lex.cc parser to parse correctly.
*/
#define IS_NUM(t)                                              \
  (((t) <= MYSQL_TYPE_INT24 && (t) != MYSQL_TYPE_TIMESTAMP) || \
   (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL)
#define IS_LONGDATA(t) ((t) >= MYSQL_TYPE_TINY_BLOB && (t) <= MYSQL_TYPE_STRING)

MYSQL_FIELD;
{
char* name;     /* Name of column */
char* org_name;   /* Original column name, if an alias */
char* table;   /* Table of column if column was a field */
char* org_table;   /* Org table name, if table was an alias */
char* db;   /* Database for table */
char* catalog;   /* Catalog for table */
char* def;   /* Default value (set by mysql_list_fields) */
 unsigned long length;   /* Width of column (create length) */
  unsigned long max_length; /* Max width for selected set */
  unsigned int name_length;
  unsigned int org_name_length;
  unsigned int table_length;
  unsigned int org_table_length;
  unsigned int db_length;
  unsigned int catalog_length;
  unsigned int def_length;
  unsigned int flags;         /* Div flags */
  unsigned int decimals;      /* Number of decimals in field */
  unsigned int charsetnr;     /* Character set */
  enum enum_field_types type; /* Type of field. See mysql_com.h for types */
  void* extension;
};

typedef char **MYSQL_ROW;   /* return data as array of strings */
typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */

#define MYSQL_COUNT_ERROR (~(uint64_t)0)

/* backward compatibility define - to be removed eventually */
#define ER_WARN_DATA_TRUNCATED WARN_DATA_TRUNCATED

Recommended Answers

All 4 Replies

I read and changed it to what it suggested and i received more errors. This is what i got.
2>E:\MYSQL\MySQL Server 8.0\include\mysql.h(123,1): error C2059: syntax error: 'function-style cast'
2>E:\MYSQL\MySQL Server 8.0\include\mysql.h(123,13): error C2143: syntax error: missing ';' before '{'
2>E:\MYSQL\MySQL Server 8.0\include\mysql.h(123,13): error C2447: '{': missing function header (old-style formal list?)
2>E:\MYSQL\MySQL Server 8.0\include\mysql.h(642,1): error C2447: '{': missing function header (old-style formal list?)
2>E:\MYSQL\MySQL Server 8.0\include\mysql.h(670,1): error C2447: '{': missing function header (old-style formal list?)
2>Done building project "database.vcxproj" -- FAILED.
========== Build: 1 succeeded, 1 failed, 23 up-to-date, 0 skipped ==========

i was able to get rid of the warnings but i received two more in a differente location. Does anyone know what to do?

    Is set to true if we need to calculate field->max_length for
    metadata fields when doing mysql_stmt_store_result.
  */
  bool update_max_length;
  struct MYSQL_STMT_EXT* extension;}

enum enum_stmt_attr_type; {
  /*
    When doing mysql_stmt_store_result calculate max_length attribute
    of statement metadata. This is to be consistent with the old API,
    where this was done automatically.
    In the new API we do that only by request because it slows down
    mysql_stmt_store_result sufficiently.
  */
  STMT_ATTR_UPDATE_MAX_LENGTH,
  /*
    unsigned long with combination of cursor flags (read only, for update,
    etc)
  */
  STMT_ATTR_CURSOR_TYPE,
  /*
    Amount of rows to retrieve from server per one fetch if using cursors.
    Accepts unsigned long attribute in the range 1 - ulong_max
  */
  STMT_ATTR_PREFETCH_ROWS
};

Now that enough code is supplied, I am going to guess you are trying to compile MySQL Server.

This may and should fail on the Community version of VS2019 or there are compile instructions at the MySQL site.

Why not use the ready to use installer at https://dev.mysql.com/downloads/mysql/ if you need MySQL server?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.