Compiling MySQL custom engine in Visual Studio 2008 - c++

I have compilation errors while compiling MySQL sample of storage engine from MySQL 5.1.36 sources. Looks to me that I set all paths to include subdirectories but that seems not enough.
Here are the errors:
1>c:\users\roman\desktop\mysql-5.1.36\sql\field.h(1455) : error C2065: 'FRM_VER' : undeclared identifier
1>c:\users\roman\desktop\mysql-5.1.36\sql\item_cmpfunc.h(1395) : error C2146: syntax error : missing ';' before identifier 'preg'
1>c:\users\roman\desktop\mysql-5.1.36\sql\item_cmpfunc.h(1395) : error C4430: missing type specifier
- int assumed. Note: C++ does not support default-int
1>c:\users\roman\desktop\mysql-5.1.36\sql\item_cmpfunc.h(1395) : error C4430: missing type specifier
- int assumed. Note: C++ does not support default-int

I had to include mysql_version.h.in library that contain all appropriate variables like FRM_VER, etc. That resolved the errors metioned above.

Related

Visual Studio 2019 has errors in built-in libraries

First time asking here, so please bear with me, or just let me know if I should do anything different.
I just installed a fresh version of Visual Studio 2019 and am trying to build a very basic C++ console application which includes Windows.h and iostream. Upon trying to build, I encounter over 100 build errors from the libraries that come with the IDE. Build output is shown below. Might anyone have a clue as to why the libraries that ship with VS2019 might cause so many build errors on their own?
Before you suggest Google and looking through other questions ashed here, I've searched in both places as well as Microsoft's knowledge base and have not been able to come across any relevant results. Thanks!
x32control.cpp:
#include "common.h"
int main ()
{
return errAndDie ("\nTesting errAndDie.\n\n");
}
common.cpp:
#include <iostream>
#include <winddi.h>
int errAndDie (const char* errorMessage) {
std::cout << errorMessage;
return -1;
common.h:
#ifndef COMMON_H
#define COMMON_H
#include <iostream>
#include <Windows.h>
int errAndDie (const char *errorMessage);
#endif
Errors:
1>common.cpp
1>D:\Windows Kits\10\Include\10.0.18362.0\um\winddi.h(90,22): error C3646: 'Data1': unknown override specifier
1>D:\Windows Kits\10\Include\10.0.18362.0\um\winddi.h(90,22): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>D:\Windows Kits\10\Include\10.0.18362.0\um\winddi.h(91,22): error C3646: 'Data2': unknown override specifier
1>D:\Windows Kits\10\Include\10.0.18362.0\um\winddi.h(91,22): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>D:\Windows Kits\10\Include\10.0.18362.0\um\winddi.h(92,22): error C3646: 'Data3': unknown override specifier
1>D:\Windows Kits\10\Include\10.0.18362.0\um\winddi.h(92,22): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>D:\Windows Kits\10\Include\10.0.18362.0\um\winddi.h(93,22): error C3646: 'Data4': unknown override specifier
1>D:\Windows Kits\10\Include\10.0.18362.0\um\winddi.h(93,22): error C2143: syntax error: missing ',' before '['
1>D:\Windows Kits\10\Include\10.0.18362.0\um\winddi.h(93,25): error C2143: syntax error: missing ')' before ';'
1>D:\Windows Kits\10\Include\10.0.18362.0\um\winddi.h(93,25): error C2238: unexpected token(s) preceding ';'
1>D:\Windows Kits\10\Include\10.0.18362.0\um\ddrawint.h(32,1): error C2146: syntax error: missing ';' before identifier 'GUID_MiscellaneousCallbacks'
1>D:\Windows Kits\10\Include\10.0.18362.0\um\ddrawint.h(32,122): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>D:\Windows Kits\10\Include\10.0.18362.0\um\ddrawint.h(33,1): error C2146: syntax error: missing ';' before identifier 'GUID_Miscellaneous2Callbacks'
1>D:\Windows Kits\10\Include\10.0.18362.0\um\ddrawint.h(33,124): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>D:\Windows Kits\10\Include\10.0.18362.0\um\ddrawint.h(34,1): error C2146: syntax error: missing ';' before identifier 'GUID_VideoPortCallbacks'
...
1>D:\Windows Kits\10\Include\10.0.18362.0\um\ddraw.h(296,44): error C3646: 'lpDDSZBufferSrc': unknown override specifier
1>D:\Windows Kits\10\Include\10.0.18362.0\um\ddraw.h(296,44): fatal error C1003: error count exceeds 100; stopping compilation
1>httpserver.cpp
1>x32control.cpp
1>Generating Code...
1>Done building project "x32control.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I have found the issue. Including winddi.h in common.cpp was the issue. I'm not entirely sure how that got in there, as I do not recall ever typing that and I don't copy/paste often. My apologies for not noticing this ahead of posting. Sometimes new contexts make it easier to see these things.

When trying to use GL3W.h: error C2146: syntax error : missing ';' before identifier 'gl3wBindTexture'

I am trying to use GL3W to get the function pointers for an OpeGL framework that I am making. Anytime that I include gl3w.h in the project, I get 28 errors. Here they are:
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(74): error
C2146: syntax error : missing ';' before identifier 'gl3wBindTexture'
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(74): error
C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(140): error
C2146: syntax error : missing ';' before identifier
'gl3wCopyTexImage1D'
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(140): error
C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(141): error
C2146: syntax error : missing ';' before identifier
'gl3wCopyTexImage2D'
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(141): error
C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(142): error
C2146: syntax error : missing ';' before identifier
'gl3wCopyTexSubImage1D'
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(142): error
C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(143): error
C2146: syntax error : missing ';' before identifier
'gl3wCopyTexSubImage2D'
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(143): error
C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(178): error
C2146: syntax error : missing ';' before identifier
'gl3wDeleteTextures'
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(178): error
C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(195): error
C2146: syntax error : missing ';' before identifier 'gl3wDrawArrays'
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(195): error
C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(201): error
C2146: syntax error : missing ';' before identifier 'gl3wDrawElements'
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(201): error
C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(241): error
C2146: syntax error : missing ';' before identifier 'gl3wGenTextures'
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(241): error
C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(299): error
C2146: syntax error : missing ';' before identifier 'gl3wGetPointerv'
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(299): error
C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(410): error
C2146: syntax error : missing ';' before identifier 'gl3wIsTexture'
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(410): error
C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(464): error
C2146: syntax error : missing ';' before identifier
'gl3wPolygonOffset'
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(464): error
C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(572): error
C2146: syntax error : missing ';' before identifier
'gl3wTexSubImage1D'
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(572): error
C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(573): error
C2146: syntax error : missing ';' before identifier
'gl3wTexSubImage2D'
1>c:\projects\project_boxes\exlib\ogl_headers\gl\gl3w.h(573): error
C4430: missing type specifier - int assumed. Note: C++ does not
support default-int 2> Killer1_Engine.vcxproj ->
C:\Projects\Killer1_Engine\Build\Killer1_Engine....\Bin\Win32Debug\Killer1_Engine_Win32_Debug.lib
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I downloaded the source code from the GL3W site, and have tried it both after compiling the code into a static library (.lib) and with just including the .c file, and the headers. When I compile the library, it works without issues, but its whenever I link to it that I have issues. I would really like to use this library, but I have no idea what I am doing wrong.

How to fix compile errors when including emscripten headers?

I'm trying to use emscripten Embind to bind C++ functions to JavaScript. Unfortunately I already get compile errors when including the specific header file with #include <emscripten/bind.h>.
I checked my emscripten environment and set an additonal Include Directory in VS2013 to the absolute path of the installation folder (also tried $(EMSCRIPTEN); and adapted the inlcude statement).
When compiling my project, I get 20+ compile errors:
17>d:\program files\emscripten\emscripten\1.25.0\system\include\emscripten\wire.h(24): error C2144: syntax error : 'bool' should be preceded by ';'
17>d:\program files\emscripten\emscripten\1.25.0\system\include\emscripten\wire.h(24): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
17>d:\program files\emscripten\emscripten\1.25.0\system\include\emscripten\wire.h(39): error C2146: syntax error : missing ';' before identifier 'TYPEID'
17> d:\program files\emscripten\emscripten\1.25.0\system\include\emscripten\wire.h(42) : see reference to class template instantiation 'emscripten::internal::CanonicalizedID<T>' being compiled
17>d:\program files\emscripten\emscripten\1.25.0\system\include\emscripten\wire.h(39): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
17>d:\program files\emscripten\emscripten\1.25.0\system\include\emscripten\wire.h(54): error C2146: syntax error : missing ';' before identifier 'TYPEID'
...
I tried emscripten 1.22.0 and 1.25.0 and verified my emscripten environment following those instructions. What am I missing?
As far as I know, of the MS Visual Studio editions, only VS2010 is supported in Emscripten.
http://kripken.github.io/emscripten-site/docs/getting_started/getting_started_with_emscripten_and_vs2010.html#getting-started-emscripten-from-visual-studio

How to use opencv header in visual studio windows app

I did my work in visual studio 2010 c++ console , but now i am trying to convert my work into windows app (making interface of it) in visual studio c++ . For that i have to add some header files which i have to add manually in windows form application, like
and it show me some error's in it like
DetectRegions.h(10): error C2146: syntax error : missing ';' before identifier 'filename'
DetectRegions.h(10): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
DetectRegions.h(10): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
DetectRegions.h(11): error C2061: syntax error : identifier 'string'
DetectRegions.h(14): error C2143: syntax error : missing ';' before '<'
DetectRegions.h(14): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
DetectRegions.h(14): error C2238: unexpected token(s) preceding ';'
DetectRegions.h(16): error C2143: syntax error : missing ';' before '<'
DetectRegions.h(16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
DetectRegions.h(16): error C2238: unexpected token(s) preceding ';'
DetectRegions.h(17): error C2061: syntax error : identifier 'RotatedRect'
DetectRegions.h(18): error C2653: 'cv' : is not a class or namespace name
DetectRegions.h(18): error C2146: syntax error : missing ';' before identifier 'histeq'
DetectRegions.h(18): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
DetectRegions.h(18): error C2061: syntax error : identifier 'Mat'
DetectRegions.h(18): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
DetectRegions.h(18): warning C4183: 'histeq': missing return type; assumed to be a member function returning 'int'
Plate.h is same like DetectRegions.h
I add the other headers of opencv in Form1.h like
#include "opencv2/features2d/features2d.hpp"
#include <opencv/highgui.h>
#include "opencv2/opencv.hpp" .......
You're using std::string and std::vector in DetectRegions.h, but aren't including their headers
#include <string>
#include <vector>
Likewise, you need to include the cv headers there if you're using them there.

How to SWIG in VS2010?

Hey Everybody,
I'm trying to SWIG a multi file project that I made in VS2010 (c++) to python. I've managed to link the Python26.lib file, and have SWIG generating a wrapper .cpp file for my main .cpp file. I've set my code to build a .dll with the extension .pyd.
This is the .i file I have currently:
%module HiveGPS
%{
#include "ou_thread.h"
#include "HiveGPS.h"
%}
%include ou_thread.h
%include HiveGPS.h
And I've mangaed to get a .py and .pyc file. Now, from my understanding in order to run my .py file, I need to link it to my .pyd file, but when I try to use VS2010 to build my project with the settings I listed above, it complains about a Thread class I'm using:
1>------ Build started: Project: HiveGPS, Configuration: Release Win32 ------
1>Build started 5/11/2011 1:41:30 PM.
1>InitializeBuildStatus:
1> Touching "Release\HiveGPS.unsuccessfulbuild".
1>ClCompile:
1> HiveGPS_wrap.cpp
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(57): error C2146: syntax error : missing ';' before identifier 'm_strName'
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(57): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(57): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(64): error C2146: syntax error : missing ';' before identifier 'getName'
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(64): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(64): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(64): warning C4183: 'getName': missing return type; assumed to be a member function returning 'int'
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(98): error C2146: syntax error : missing ';' before identifier 'm_strName'
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(98): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(98): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(104): error C2146: syntax error : missing ';' before identifier 'getName'
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(104): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(104): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(104): warning C4183: 'getName': missing return type; assumed to be a member function returning 'int'
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(115): error C2146: syntax error : missing ';' before identifier 'msg'
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(115): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(115): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(118): error C2146: syntax error : missing ';' before identifier 'getMessage'
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(118): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(118): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(118): warning C4183: 'getMessage': missing return type; assumed to be a member function returning 'int'
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(51): error C2011: 'openutils::Thread' : 'class' type redefinition
1> c:\users\*\desktop\hivegps\hivegps\ou_thread.h(51) : see declaration of 'openutils::Thread'
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(93): error C2011: 'openutils::Mutex' : 'class' type redefinition
1> c:\users\*\desktop\hivegps\hivegps\ou_thread.h(93) : see declaration of 'openutils::Mutex'
1>c:\users\*\desktop\hivegps\hivegps\ou_thread.h(113): error C2011: 'openutils::ThreadException' : 'class' type redefinition
1> c:\users\*\desktop\hivegps\hivegps\ou_thread.h(113) : see declaration of 'openutils::ThreadException'
1>c:\users\*\desktop\hivegps\hivegps\HiveGPS.h(29): error C2504: 'openutils::Thread' : base class undefined
1>c:\users\*\desktop\hivegps\hivegps\HiveGPS.h(53): error C2079: 'HiveGPS::readWriteMutex' uses undefined class 'openutils::Mutex'
1>HiveGPS_wrap.cpp(3086): error C2027: use of undefined type 'openutils::Thread'
1> c:\users\*\desktop\hivegps\hivegps\ou_thread.h(51) : see declaration of 'openutils::Thread'
1>HiveGPS_wrap.cpp(3086): fatal error C1903: unable to recover from previous error(s); stopping compilation
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:02.10
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
All of these errors (minus the last one) are basically saying that the String class is implemented somehow, is it conflicting with Python's definition of the String class? The last error is complaining about the Thread class, could that be the same problem?
All of that said:
Can somebody tell me what I'm doing wrong, or better yet, point me to a tutorial of how to do this for VS2010 (the SWIG site is for 2008).
And if that can't be done, can I link the .py file I have generated to the .dll file somehow?
Sorry for the long explanation but I'm kinda lost on this one so I decided to explain everything.
Ok, I'm using swig and VS2010 with no problems...
In your case, it looks more like you have problems with linking. Beyond the check of libraries, dont forget to check 32-64 bit libraries you are linking. Try to link all as x86 target as fail-safe. And don't use AnyCpu.
How to use SWIG under VS2010.
lets define you want to obtain mylib.py, so you created some SWIG interface files with mylib.i as "main" file. I assume that you already have a solution with project with your C++ classes there.
(1) First create C++ project for SWIG interface. Use Visual C++->Class library project which should create a C++ DLL stub. I put all .i files there. And set visual studio to highlight .i as .h - it is handy.
(1.1) Add mylib_wrap.cxx file to the project (create empty file while swig hasn't generated one yet)
(2)
a) Press right button over the mylib.i, choose properties.
b) set ItemType as "Custom build tool".
In custom build step window:
c) Command line field should be something like:
echo In order to function correctly, please ensure the following environment variables are
correctly set:
echo PYTHON_INCLUDE: %PYTHON_INCLUDE%
echo PYTHON_LIB: %PYTHON_LIB%
echo on
C:\swig\swig.exe -c++ -python %(FullPath)
change C:\swig\swig.exe to your path to SWIG
d) In Outputs field:
$(InputName)_wrap.cxx
(3) Go to this project properties:
a) C++ tab -> Additional Include Directories
add $(PYTHON_INCLUDE); ...
c) Linker -> Output File
Path-You-Needed\_mylib.pyd
d) Linker -> Enable Incremental Linking
set as No (/INCREMENTAL:NO)
e) Linker -> Input -> Additional Dependencies
add $(PYTHON_LIB);...
f) C/C++ -> Precompiled Headers:
Switch off precompiled headers, set **Not Using Precompiled Headers* and remove stdafx files after
g) General tab. Just check that these are set:
Configuration type = Dynamic Library (.dll)
Character set = Use Unicode Character Set
Common Language Runtime Support = No Common Language Runtime Support
It compiles.
P.S. And dont forget to set %PYTHON_INCLUDE% and %PYTHON_LIB% variables in your system too.
It seems that some #include is missing in the ou_thread.h.
Further more, the "'class' type redefinition" can indicate that you don't have something like
#ifndef __ou_thread_h__
#define __ou_thread_h__
// your stuff, classes, etc.
#endif
in your ou_thread.h
It's a guessing...