I was trying out openGL with SDL for the first time in Visual Studio 2013.
SDL worked fine, but I somehow don't get how I should set up my project so that I can use openGL.
I included 'openGL32.lib' in my linker input, have a #include to the "GL\gl.h" header, but I get a compilation error, and the errors seem to be in the gl.h I included. Here is the code:
#include <stdio.h>
#include <stdlib.h>
/* If using gl3.h */
/* Ensure we are using opengl's core profile only */
#define GL3_PROTOTYPES 1
#include <C:\Program Files\Microsoft SDKs\Windows\v7.1A\Include\gl\gl.h>
#include <SDL.h>
#define PROGRAM_NAME "Tutorial1"
/* A simple function that prints a message, the error code returned by SDL,
* and quits the application */
void sdldie(const char *msg)
{
printf("%s: %s\n", msg, SDL_GetError());
SDL_Quit();
exit(1);
}
void checkSDLError(int line = -1)
{
#ifndef NDEBUG
const char *error = SDL_GetError();
if (*error != '\0')
{
printf("SDL Error: %s\n", error);
if (line != -1)
printf(" + line: %i\n", line);
SDL_ClearError();
}
#endif
}
/* Our program's entry point */
int main(int argc, char *argv[])
{
SDL_Window *mainwindow; /* Our window handle */
SDL_GLContext maincontext; /* Our opengl context handle */
if (SDL_Init(SDL_INIT_VIDEO) < 0) /* Initialize SDL's Video subsystem */
sdldie("Unable to initialize SDL"); /* Or die on error */
/* Request opengl 3.2 context.
* SDL doesn't have the ability to choose which profile at this time of writing,
* but it should default to the core profile */
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
/* Turn on double buffering with a 24bit Z buffer.
* You may need to change this to 16 or 32 for your system */
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
/* Create our window centered at 512x512 resolution */
mainwindow = SDL_CreateWindow(PROGRAM_NAME, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
512, 512, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN);
if (!mainwindow) /* Die if creation failed */
sdldie("Unable to create window");
checkSDLError(__LINE__);
/* Create our opengl context and attach it to our window */
maincontext = SDL_GL_CreateContext(mainwindow);
checkSDLError(__LINE__);
/* This makes our buffer swap syncronized with the monitor's vertical refresh */
SDL_GL_SetSwapInterval(1);
/* Clear our buffer with a red background */
glClearColor(1.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
/* Swap our back buffer to the front */
SDL_GL_SwapWindow(mainwindow);
/* Wait 2 seconds */
SDL_Delay(2000);
/* Same as above, but green */
glClearColor(0.0, 1.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
SDL_GL_SwapWindow(mainwindow);
SDL_Delay(2000);
/* Same as above, but blue */
glClearColor(0.0, 0.0, 1.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
SDL_GL_SwapWindow(mainwindow);
SDL_Delay(2000);
/* Delete our opengl context, destroy our window, and shutdown SDL */
SDL_GL_DeleteContext(maincontext);
SDL_DestroyWindow(mainwindow);
SDL_Quit();
return 0;
}
And this is the error I get:
1>------ Build started: Project: SDL_OGL_Learning, Configuration: Debug Win32 ------
1> Source.cpp
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152): error C2146: syntax error : missing ';' before identifier 'glAccum'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152): error C2182: 'APIENTRY' : illegal use of type 'void'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1153): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1153): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1153): error C2086: 'int WINGDIAPI' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'WINGDIAPI'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1153): error C2146: syntax error : missing ';' before identifier 'glAlphaFunc'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1153): error C2182: 'APIENTRY' : illegal use of type 'void'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1153): error C2086: 'int APIENTRY' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'APIENTRY'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1154): error C2146: syntax error : missing ';' before identifier 'GLboolean'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1154): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1154): error C2086: 'int WINGDIAPI' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'WINGDIAPI'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1154): error C2146: syntax error : missing ';' before identifier 'glAreTexturesResident'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1154): error C2371: 'APIENTRY' : redefinition; different basic types
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'APIENTRY'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1155): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1155): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1155): error C2086: 'int WINGDIAPI' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'WINGDIAPI'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1155): error C2146: syntax error : missing ';' before identifier 'glArrayElement'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1155): error C2182: 'APIENTRY' : illegal use of type 'void'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1155): error C2086: 'int APIENTRY' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'APIENTRY'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1156): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1156): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1156): error C2086: 'int WINGDIAPI' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'WINGDIAPI'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1156): error C2146: syntax error : missing ';' before identifier 'glBegin'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1156): error C2182: 'APIENTRY' : illegal use of type 'void'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1156): error C2086: 'int APIENTRY' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'APIENTRY'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1157): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1157): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1157): error C2086: 'int WINGDIAPI' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'WINGDIAPI'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1157): error C2146: syntax error : missing ';' before identifier 'glBindTexture'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1157): error C2182: 'APIENTRY' : illegal use of type 'void'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1157): error C2086: 'int APIENTRY' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'APIENTRY'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1158): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1158): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1158): error C2086: 'int WINGDIAPI' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'WINGDIAPI'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1158): error C2146: syntax error : missing ';' before identifier 'glBitmap'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1158): error C2182: 'APIENTRY' : illegal use of type 'void'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1158): error C2086: 'int APIENTRY' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'APIENTRY'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1159): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1159): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1159): error C2086: 'int WINGDIAPI' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'WINGDIAPI'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1159): error C2146: syntax error : missing ';' before identifier 'glBlendFunc'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1159): error C2182: 'APIENTRY' : illegal use of type 'void'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1159): error C2086: 'int APIENTRY' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'APIENTRY'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1160): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1160): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1160): error C2086: 'int WINGDIAPI' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'WINGDIAPI'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1160): error C2146: syntax error : missing ';' before identifier 'glCallList'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1160): error C2182: 'APIENTRY' : illegal use of type 'void'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1160): error C2086: 'int APIENTRY' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'APIENTRY'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1161): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1161): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1161): error C2086: 'int WINGDIAPI' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'WINGDIAPI'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1161): error C2146: syntax error : missing ';' before identifier 'glCallLists'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1161): error C2182: 'APIENTRY' : illegal use of type 'void'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1161): error C2086: 'int APIENTRY' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'APIENTRY'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1162): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1162): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1162): error C2086: 'int WINGDIAPI' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'WINGDIAPI'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1162): error C2146: syntax error : missing ';' before identifier 'glClear'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1162): error C2182: 'APIENTRY' : illegal use of type 'void'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1162): error C2086: 'int APIENTRY' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'APIENTRY'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1163): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1163): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1163): error C2086: 'int WINGDIAPI' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'WINGDIAPI'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1163): error C2146: syntax error : missing ';' before identifier 'glClearAccum'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1163): error C2182: 'APIENTRY' : illegal use of type 'void'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1163): error C2086: 'int APIENTRY' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'APIENTRY'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1164): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1164): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1164): error C2086: 'int WINGDIAPI' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'WINGDIAPI'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1164): error C2146: syntax error : missing ';' before identifier 'glClearColor'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1164): error C2182: 'APIENTRY' : illegal use of type 'void'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1164): error C2086: 'int APIENTRY' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'APIENTRY'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1165): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1165): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1165): error C2086: 'int WINGDIAPI' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'WINGDIAPI'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1165): error C2146: syntax error : missing ';' before identifier 'glClearDepth'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1165): error C2182: 'APIENTRY' : illegal use of type 'void'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1165): error C2086: 'int APIENTRY' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'APIENTRY'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1166): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1166): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1166): error C2086: 'int WINGDIAPI' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'WINGDIAPI'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1166): error C2146: syntax error : missing ';' before identifier 'glClearIndex'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1166): error C2182: 'APIENTRY' : illegal use of type 'void'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1166): error C2086: 'int APIENTRY' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'APIENTRY'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1167): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1167): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1167): error C2086: 'int WINGDIAPI' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'WINGDIAPI'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1167): error C2146: syntax error : missing ';' before identifier 'glClearStencil'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1167): error C2182: 'APIENTRY' : illegal use of type 'void'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1167): error C2086: 'int APIENTRY' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'APIENTRY'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1168): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1168): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1168): error C2086: 'int WINGDIAPI' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'WINGDIAPI'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1168): error C2146: syntax error : missing ';' before identifier 'glClipPlane'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1168): error C2182: 'APIENTRY' : illegal use of type 'void'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1168): error C2086: 'int APIENTRY' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'APIENTRY'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1169): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1169): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1169): error C2086: 'int WINGDIAPI' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'WINGDIAPI'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1169): error C2146: syntax error : missing ';' before identifier 'glColor3b'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1169): error C2182: 'APIENTRY' : illegal use of type 'void'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1169): error C2086: 'int APIENTRY' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'APIENTRY'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1170): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1170): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1170): error C2086: 'int WINGDIAPI' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'WINGDIAPI'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1170): error C2146: syntax error : missing ';' before identifier 'glColor3bv'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1170): error C2182: 'APIENTRY' : illegal use of type 'void'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1170): error C2086: 'int APIENTRY' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'APIENTRY'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1171): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1171): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1171): error C2086: 'int WINGDIAPI' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'WINGDIAPI'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1171): error C2146: syntax error : missing ';' before identifier 'glColor3d'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1171): error C2182: 'APIENTRY' : illegal use of type 'void'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1171): error C2086: 'int APIENTRY' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'APIENTRY'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1172): error C2144: syntax error : 'void' should be preceded by ';'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1172): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1172): error C2086: 'int WINGDIAPI' : redefinition
1> c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1152) : see declaration of 'WINGDIAPI'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1172): error C2146: syntax error : missing ';' before identifier 'glColor3dv'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1172): error C2182: 'APIENTRY' : illegal use of type 'void'
1>c:\program files\microsoft sdks\windows\v7.1a\include\gl\gl.h(1172): fatal error C1003: error count exceeds 100; stopping compilation
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
What should I do?
It seems you should include <Windows.h> first to get Windows API definitions such as APIENTRY.
Related
Anything I try to npm install on windows that requires node-gyp explodes in errors. I tried reinstalling all the windows stuff suggested on the node-gyp github page.
Why am I getting these errors? This is an attempt to install mongodb
PS C:\Users\Farzher\Documents\Dev\nodejs\abc> npm install mongodb
npm WARN package.json prelude-ls-extended#0.0.0 No description
npm http GET https://registry.npmjs.org/mongodb
npm http 304 https://registry.npmjs.org/mongodb
npm http GET https://registry.npmjs.org/bson/0.2.5
npm http GET https://registry.npmjs.org/kerberos/0.0.3
npm http 304 https://registry.npmjs.org/bson/0.2.5
npm http 304 https://registry.npmjs.org/kerberos/0.0.3
> kerberos#0.0.3 install C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos
> (node-gyp rebuild 2> builderror.log) || (exit 0)
C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos>node "c:\Program Files\nodejs\node_modules\npm\bin\node-gyp-
bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
kerberos.cc
worker.cc
security_credentials.cc
security_buffer.cc
security_buffer_descriptor.cc
security_context.cc
c:\users\farzher\node_modules\mongodb\node_modules\kerberos\lib\win32\worker.h(17): error C2146: syntax error : missing
';' before identifier 'request' [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build\kerberos.vcxproj]
c:\users\farzher\node_modules\mongodb\node_modules\kerberos\lib\win32\worker.h(17): error C4430: missing type specifier
- int assumed. Note: C++ does not support default-int [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\bui
ld\kerberos.vcxproj]
c:\users\farzher\node_modules\mongodb\node_modules\kerberos\lib\win32\worker.h(17): error C4430: missing type specifier
- int assumed. Note: C++ does not support default-int [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\bui
ld\kerberos.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xlocale(323): warning C4530: C++ exception handler used,
but unwind semantics are not enabled. Specify /EHsc [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build
\kerberos.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xlocale(323): warning C4530: C++ exception handler used,
but unwind semantics are not enabled. Specify /EHsc [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build
\kerberos.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xlocale(323): warning C4530: C++ exception handler used,
but unwind semantics are not enabled. Specify /EHsc [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build
\kerberos.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xlocale(323): warning C4530: C++ exception handler used,
but unwind semantics are not enabled. Specify /EHsc [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build
\kerberos.vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\sspi.h(82): error C2146: syntax error : missing ';' before
identifier 'SEC_WCHAR' [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build\kerberos.vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\sspi.h(82): error C4430: missing type specifier - int assum
ed. Note: C++ does not support default-int [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build\kerberos.
vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\sspi.h(82): error C4430: missing type specifier - int assum
ed. Note: C++ does not support default-int [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build\kerberos.
vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\sspi.h(83): error C2146: syntax error : missing ';' before
identifier 'SEC_CHAR' [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build\kerberos.vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\sspi.h(83): error C4430: missing type specifier - int assum
ed. Note: C++ does not support default-int [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build\kerberos.
vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\sspi.h(83): error C4430: missing type specifier - int assum
ed. Note: C++ does not support default-int [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build\kerberos.
vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\sspi.h(86): error C2146: syntax error : missing ';' before
identifier 'SECURITY_STATUS' [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build\kerberos.vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\sspi.h(86): error C4430: missing type specifier - int assum
ed. Note: C++ does not support default-int [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build\kerberos.
vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\sspi.h(86): error C4430: missing type specifier - int assum
ed. Note: C++ does not support default-int [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build\kerberos.
vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\sspi.h(105): error C2143: syntax error : missing ';' before
'*' [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build\kerberos.vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\sspi.h(105): error C4430: missing type specifier - int assu
med. Note: C++ does not support default-int [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build\kerberos
.vcxproj]
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\sspi.h(105): error C2378: 'SEC_CHAR' : redefinition; symbol
cannot be overloaded with a typedef [C:\Users\Farzher\node_modules\mongodb\node_modules\kerberos\build\kerberos.vcxpro
You need Python on your machine for gyp to work, AFAIK.
I am currently mirroring the DB2 to local MySQL-db with some jdbc-code. I would like to connect DB2 directly from Node.js app without having to query the mirror. I am running on Windows and I cannot change to Linux. It seems that work on DB2 with Node.js is yet very marginal or node-odbc is used (unixODBC bindings for node).
I found this project https://github.com/herzi/db2.js which provides DB2-bindings for Node but I cannot install it as the install fails. The package requires Node-gyp (installed this successfully) and .NET framework SDK. I set the vcbuild.exe into my PATH. After these the msbuild.exe complained about missing header files (sqlcli1.h, sqlsystm.h, sqlca.h), which I found out are part of PRO*C.
I took the header files above from here: http://files.edin.dk/php/win32/dev/php_build/include/db2/ and put them into my Node's src/ directory. Now the compiler shows multiple errors.
Are there any other options when working with Windows to connect DB2 from Node.js app than try to get the above module to work?
Anyone able to help me out here? What are the steps to get the above module installed?
Thanks!
Errors shown:
C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sqlext.h(30): error C2146 : syntax error : missing ';' before identifier 'SQLSTATE' [C:\IS\node\node_modules\db2\build\db2.vcxproj]
C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sqlext.h(30): error C2146: syntax error : missing ';' before identifier 'SQLSTATE' [C:\IS\node\node_modules\db2\build\db2.vcxproj]
C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sqlext.h(30): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [C:\IS\node\node_modules\db2\build\db2.vcxproj]
C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sqlext.h(30): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [C:\IS\node\node_modules\db2\build\db2.vcxproj]
C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sqlext.h(30): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [C:\IS\node\node_modules\db2\build\db2.vcxproj]
C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sqlext.h(30): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [C:\IS\node\node_modules\db2\build\db2.vcxproj]
C:\Documents and Settings\tpaleniu\.node-gyp\0.8.12\src\sqlcli1.h(1501): error C2371: 'SQLTCHAR' : redefinition; different basic types [C:\IS\node\node_modules\db2\build\db2.vcxproj]
C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\sqlext.h(30) : see declaration of 'SQLTCHAR'
..\src\connection.cc(77): error C3861: 'snprintf': identifier not found
[C:\IS\node\node_modules\db2\build\db2.vcxproj]..\src\connection.cc(80): error C3861: 'snprintf': identifier not found [C:\IS\node\node_modules\db2\build\db2.vcxproj]
..\src\connection.cc(111): error C3861: 'bzero': identifier not found [C:\IS\node\node_modules\db2\build\db2.vcxproj]
..\src\connection.cc(208): error C3861: 'bzero': identifier not found [C:\IS\node\node_modules\db2\build\db2.vcxproj]
..\src\connection.cc(547): error C2057: expected constant expression [C:\IS\node\node_modules\db2\build\db2.vcxproj]
..\src\connection.cc(547): error C2466: cannot allocate an array of constant size 0 [C:\IS\node\node_modules\db2\build\db2.vcxproj]
..\src\connection.cc(547): error C2133: 'argv' : unknown size [C:\IS\node\node_modules\db2\build\db2.vcxproj]
It is true that node-odbc currently is currently meant only for use with unixODBC. But Daniel VerWeire is currently working on supporting node-odbc on Windows. I guess you need to wait a little while.
Praveen will have a post on it here as soon as it is available
I have a very simple C++/CLI window form program which is 100% working alright.
Since I want to add call internet explorer when I click a button on my window form, I add "ONE LINE of code" for testing purpose.
I add #include "Shellapi.h" under #pragma once. After that, VS gives me 500 lines of an error message.
My question is that I am only adding a .h file into my program. Why there will cause any problem? Do I miss something?
===========The first few lines of the error message===============
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\Shellapi.h(56): error C2065: 'HDROP' : undeclared identifier
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\Shellapi.h(56): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\Shellapi.h(59): error C2146: syntax error : missing ';' before identifier 'DECLSPEC_IMPORT'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\Shellapi.h(59): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\Shellapi.h(59): error C2146: syntax error : missing ';' before identifier 'UINT'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\Shellapi.h(59): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\Shellapi.h(59): error C2146: syntax error : missing ';' before identifier 'STDAPICALLTYPE'
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\Shellapi.h(59): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Several things:
You should #include <windows.h> in any windows program
You should include any system file - like shellapi.h - using brackets (<>) instead of quotes (""), e.g. #include <shellapi.h>
If you're compiling from the command line, it's a good idea to run "vcvars32.bat" (or equivalent) to set your command-line environment for Visual Studio.
I believe you forgot to #include <windows.h> before #include <shellapi.h>
Generally, (or atleast in my personal experiences), when you are bombarded with a wall of errors after including a header, your missing <windows.h> or some other header.
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
i've got to do a bit of pure ANSI C and i'm trying to do it in Visual Studio 2010. Problem is; regardless of setting the compiler to pure C and flipping the \Za compiler switch to disable windows extensions - the code just won't compile:
#define _USE_MATH_DEFINES
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
cout << M_PI;
return 0;
}
This is in a file called Test.c - there are no precompiled headers and everything should be fine, but this is what the compiler spits out:
1>ClCompile:
1> Test.c
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error C2061: syntax error : identifier 'acosf'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error C2061: syntax error : identifier 'asinf'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error C2061: syntax error : identifier 'atanf'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error C2061: syntax error : identifier 'atan2f'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error C2061: syntax error : identifier 'ceilf'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(21): error C2061: syntax error : identifier 'cosf'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(21): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(21): error C2061: syntax error : identifier 'coshf'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(21): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(21): error C2061: syntax error : identifier 'expf'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(21): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(22): error C2061: syntax error : identifier 'fabsf'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(22): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(22): error C2061: syntax error : identifier 'floorf'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(22): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(22): error C2061: syntax error : identifier 'fmodf'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(22): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(23): error C2061: syntax error : identifier 'frexpf'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(23): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(23): error C2061: syntax error : identifier 'ldexpf'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(23): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(23): error C2061: syntax error : identifier 'logf'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(23): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(24): error C2061: syntax error : identifier 'log10f'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(24): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(24): error C2061: syntax error : identifier 'modff'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(24): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(24): error C2061: syntax error : identifier 'powf'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(24): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(25): error C2061: syntax error : identifier 'sinf'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(25): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(25): error C2061: syntax error : identifier 'sinhf'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(25): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(25): error C2061: syntax error : identifier 'sqrtf'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(25): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(26): error C2061: syntax error : identifier 'tanf'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(26): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(26): error C2061: syntax error : identifier 'tanhf'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(26): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(28): error C2061: syntax error : identifier 'acosl'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(28): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(28): error C2061: syntax error : identifier 'asinl'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(28): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(29): error C2061: syntax error : identifier 'atanl'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(29): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(29): error C2061: syntax error : identifier 'atan2l'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(29): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(29): error C2061: syntax error : identifier 'ceill'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(29): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(30): error C2061: syntax error : identifier 'cosl'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(30): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(30): error C2061: syntax error : identifier 'coshl'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(30): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(30): error C2061: syntax error : identifier 'expl'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(30): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(31): error C2061: syntax error : identifier 'fabsl'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(31): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(31): error C2061: syntax error : identifier 'floorl'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(31): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(31): error C2061: syntax error : identifier 'fmodl'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(31): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(32): error C2061: syntax error : identifier 'frexpl'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(32): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(32): error C2061: syntax error : identifier 'ldexpl'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(32): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(32): error C2061: syntax error : identifier 'logl'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(32): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(33): error C2061: syntax error : identifier 'log10l'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(33): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(33): error C2061: syntax error : identifier 'modfl'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(33): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(33): error C2061: syntax error : identifier 'powl'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(33): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(34): error C2061: syntax error : identifier 'sinl'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(34): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(34): error C2061: syntax error : identifier 'sinhl'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(34): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(34): error C2061: syntax error : identifier 'sqrtl'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(34): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(35): error C2061: syntax error : identifier 'tanl'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(35): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(35): error C2061: syntax error : identifier 'tanhl'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(35): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(37): error C2061: syntax error : identifier 'abs'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(37): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(39): error C2061: syntax error : identifier 'acos'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(39): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(39): error C2061: syntax error : identifier 'asin'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(39): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(40): error C2061: syntax error : identifier 'atan'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(40): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(40): error C2061: syntax error : identifier 'atan2'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(40): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(40): error C2061: syntax error : identifier 'ceil'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(40): error C2059: syntax error : ';'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(41): error C2061: syntax error : identifier 'cos'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(41): fatal error C1003: error count exceeds 100; stopping compilation
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.17
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I'm not that experienced with VS and C, but i've looked around and nothing I do seems to work. I'm guessing it'll be something silly. Thanks in advance
(Note: this same error occurs with absolutely no references to any math libraries)
When I include a standard library into my VS2010 project, I get a TON of errors like these (these errors were from adding in shellapi.h). I get similar errors when adding in something like Windows.h or Wininet.h or anything like that.
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(56): error C2065: 'HDROP' : undeclared identifier
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(56): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(59): error C2144: syntax error : 'int' should be preceded by ';'
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(59): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(59): error C2146: syntax error : missing ';' before identifier 'STDAPICALLTYPE'
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(59): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(59): error C2146: syntax error : missing ';' before identifier 'DragQueryFileA'
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(59): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(59): error C2065: 'HDROP' : undeclared identifier
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(59): error C2146: syntax error : missing ')' before identifier 'hDrop'
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(59): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(59): error C2059: syntax error : ')'
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(61): error C2144: syntax error : 'int' should be preceded by ';'
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(61): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include\ShellAPI.h(61): error C2086: 'int EXTERN_C' : redefinition
I'm sure this is just something to do with a project setting, but I have no idea what setting I need to change. Where should I begin?
UPDATE
The solution was to make sure that windows.h was loaded first. I did not know it was dependent on that. For future reference, where should I have looked to see that dependency?
I got these exact same errors when adding
#include <shellapi.h>
to one of my files. I solved the problem by adding
#include <windows.h>
directly before it.
(You've got to love - or rather, hate - Windows headers that don't #include the headers that they themselves require. If I did that in my own code I'd get yelled at by my superiors!)
This happens when one of your includes is broken, then you include a standard header, because your syntax error directly carries on. For example, if you forget a semi, then include another header, that header will report syntax errors. For this reason, you should always include "clean" headers like system headers first, then own-defined headers.