Microsoft C++ Pre-defined Macros [duplicate] - c++

This question already has answers here:
How to find out cl.exe's built-in macros
(7 answers)
Closed 6 years ago.
Is there a cl.exe option to dump all the pre-defined Macros ( along with the defined values ).
Something like gcc -dM -E - < /dev/null for gcc.

Unfortunately, I don't think MSVC has a built in way of doing this.
I've used the following program to dump values of 'known' predefined symbols. I should give attribution (because I know I didn't come up with this), but I don't have notes on where I got it from (update: looks like I probably got it from here: http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/644c12ed-e3a7-4c5a-a73a-610fcc7913ca)...
#define __STR2__(x) #x
#define __STR1__(x) __STR2__(x)
#define __PPOUT__(x) "#define " #x " " __STR1__(x)
#if defined(_ATL_VER)
#pragma message(__PPOUT__(_ATL_VER ))
#endif
#if defined(_CHAR_UNSIGNED )
#pragma message(__PPOUT__(_CHAR_UNSIGNED ))
#endif
#if defined(__CLR_VER )
#pragma message(__PPOUT__(__CLR_VER ))
#endif
#if defined(__cplusplus_cli )
#pragma message(__PPOUT__(__cplusplus_cli ))
#endif
#if defined(__COUNTER__ )
#pragma message(__PPOUT__(__COUNTER__ ))
#endif
#if defined(__cplusplus )
#pragma message(__PPOUT__(__cplusplus ))
#endif
#if defined(_CPPLIB_VER )
#pragma message(__PPOUT__(_CPPLIB_VER ))
#endif
#if defined(_CPPRTTI )
#pragma message(__PPOUT__(_CPPRTTI ))
#endif
#if defined(_CPPUNWIND )
#pragma message(__PPOUT__(_CPPUNWIND ))
#endif
#if defined(_DEBUG )
#pragma message(__PPOUT__(_DEBUG ))
#endif
#if defined(_DLL )
#pragma message(__PPOUT__(_DLL ))
#endif
#if defined(__FUNCDNAME__ )
#pragma message(__PPOUT__(__FUNCDNAME__ ))
#endif
#if defined(__FUNCSIG__ )
#pragma message(__PPOUT__(__FUNCSIG__ ))
#endif
#if defined(__FUNCTION__ )
#pragma message(__PPOUT__(__FUNCTION__ ))
#endif
#if defined(_INTEGRAL_MAX_BITS )
#pragma message(__PPOUT__(_INTEGRAL_MAX_BITS ))
#endif
#if defined(_M_ALPHA )
#pragma message(__PPOUT__(_M_ALPHA ))
#endif
#if defined(_M_CEE )
#pragma message(__PPOUT__(_M_CEE ))
#endif
#if defined(_M_CEE_PURE )
#pragma message(__PPOUT__(_M_CEE_PURE ))
#endif
#if defined(_M_CEE_SAFE )
#pragma message(__PPOUT__(_M_CEE_SAFE ))
#endif
#if defined(_M_IX86 )
#pragma message(__PPOUT__(_M_IX86 ))
#endif
#if defined(_M_IA64 )
#pragma message(__PPOUT__(_M_IA64 ))
#endif
#if defined(_M_IX86_FP )
#pragma message(__PPOUT__(_M_IX86_FP ))
#endif
#if defined(_M_MPPC )
#pragma message(__PPOUT__(_M_MPPC ))
#endif
#if defined(_M_MRX000 )
#pragma message(__PPOUT__(_M_MRX000 ))
#endif
#if defined(_M_PPC )
#pragma message(__PPOUT__(_M_PPC ))
#endif
#if defined(_M_X64 )
#pragma message(__PPOUT__(_M_X64 ))
#endif
#if defined(_MANAGED )
#pragma message(__PPOUT__(_MANAGED ))
#endif
#if defined(_MFC_VER )
#pragma message(__PPOUT__(_MFC_VER ))
#endif
#if defined(_MSC_BUILD )
#pragma message(__PPOUT__(_MSC_BUILD ))
#endif
#if defined(_MSC_EXTENSIONS )
#pragma message(__PPOUT__(_MSC_EXTENSIONS ))
#endif
#if defined(_MSC_FULL_VER )
#pragma message(__PPOUT__(_MSC_FULL_VER ))
#endif
#if defined(_MSC_VER )
#pragma message(__PPOUT__(_MSC_VER ))
#endif
#if defined(__MSVC_RUNTIME_CHECKS )
#pragma message(__PPOUT__(__MSVC_RUNTIME_CHECKS ))
#endif
#if defined(_MT )
#pragma message(__PPOUT__(_MT ))
#endif
#if defined(_NATIVE_WCHAR_T_DEFINED)
#pragma message(__PPOUT__(_NATIVE_WCHAR_T_DEFINED))
#endif
#if defined(_OPENMP )
#pragma message(__PPOUT__(_OPENMP ))
#endif
#if defined(_VC_NODEFAULTLIB )
#pragma message(__PPOUT__(_VC_NODEFAULTLIB ))
#endif
#if defined(_WCHAR_T_DEFINED )
#pragma message(__PPOUT__(_WCHAR_T_DEFINED ))
#endif
#if defined(_WIN32 )
#pragma message(__PPOUT__(_WIN32 ))
#endif
#if defined(_WIN64 )
#pragma message(__PPOUT__(_WIN64 ))
#endif
#if defined(_Wp64 )
#pragma message(__PPOUT__(_Wp64 ))
#endif
void main() {}

I don't see that option in the MSDN documentation, but the list of predefined macros for Visual Studio 2008 and 2010 are available.

Related

count #define or const variables at compile time

In C++, I have some #define and also a count like this:
#define USE_1
#undef USE_2
#define USE_3
const size_t NUM_USE = (
0
#ifdef USE_1
+ 1
#endif
#ifdef USE_2
+ 1
#endif
#ifdef USE_3
+ 1
#endif
);
Now, I want to use it like this, which does not work as const variable cannot be used in a #if preprocessor statement:
#if NUM_USE > 0
// define here some specific code
#endif
One way to solve it would be to make some extra defines like this:
#ifdef USE_1
#define HAVE_ANY_USE
#else
#ifdef USE_2
#define HAVE_ANY_USE
#else
#ifdef USE_3
#define HAVE_ANY_USE
#endif
#endif
#endif
#ifdef HAVE_ANY_USE
// define here some specific code
#endif
Is there a more elegant solution, maybe by using NUM_USE from above?
You can define the USEs to be either 1 or 0 and then the sum can be a simple macro:
#define USE_1 1
#define USE_2 0
#define USE_3 1
#define NUM_USE (USE_1 + USE_2 + USE_3)

Chromium `debugger` equivalent, on `gdb` for Cygwin?

How do people trigger a breakpoint on gdb (for Cygwin, specifically) from the very source code?
Like when a JS script has the debugger word in it and Chromium dev tools trigger stop for debugging?
Here's how SDL2 implements this feature:
#if defined(_MSC_VER)
/* Don't include intrin.h here because it contains C++ code */
extern void __cdecl __debugbreak(void);
#define SDL_TriggerBreakpoint() __debugbreak()
#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) )
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
#elif defined(__386__) && defined(__WATCOMC__)
#define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
#include <signal.h>
#define SDL_TriggerBreakpoint() raise(SIGTRAP)
#else
/* How do we trigger breakpoints on this platform? */
#define SDL_TriggerBreakpoint()
#endif
The conditionals should probably resolve to __asm__ __volatile__ ( "int $3\n\t" ) on Cygwin.

Implicit Declaration of Function that Appears to be Definied

I'm porting the Texas Instruments SimpleLink driver to use with an Xmega host, and I'm getting a few implicit declaration errors when trying to build it. I know what the error means, but as far as I can tell, it should be defined. I must be missing something, I'm hoping someone can help me out.
Here is the error output, it's saying the function CC3120Disable is implicitly declared in the device.c file:
Error implicit declaration of function 'CC3120Disable' [-Werror=implicit-function-declaration] Xmega Firmware D:\CC3120SDK_1.55.00.42\simplelink_sdk_wifi_plugin_1_55_00_42\source\ti\drivers\net\wifi\source\device.c 173
device.c is pretty huge, so here are the includes, they are the very first thing in the file aside from comments:
#include <ti/drivers/net/wifi/simplelink.h>
#include <ti/drivers/net/wifi/source/protocol.h>
#include <ti/drivers/net/wifi/source/driver.h>
#include <ti/drivers/net/wifi/source/flowcont.h>
The first one (simplelink.h) starts a trail to where the function is declared, here is the first part of simplelink.h, again excluding the preamble comments:
#ifndef __SIMPLELINK_H__
#define __SIMPLELINK_H__
/* define the default types
* If user wants to overwrite it,
* he need to undef and define again */
#define _u8 unsigned char
#define _i8 signed char
#define _u16 unsigned short
#define _i16 signed short
#define _u32 unsigned long
#define _i32 signed long
#define _volatile volatile
#define _const const
#include <ti/drivers/net/wifi/porting/user.h>
#ifdef __cplusplus
extern "C"
{
#endif
user.h contains the macro definition that tells it to use the function CC3120Disable, and also an include that contains the declaration of that function. Here is the first part of user.h, without the leading comments:
#ifndef __USER_H__
#define __USER_H__
#include "board.h"
#include "noos.h"
#include "SPI.h"
#ifdef __cplusplus
extern "C" {
#endif
#include <string.h>
and here is line 371 in user.h that defines the macro:
#define sl_DeviceDisable() CC3120Disable()
Finally, here is all of my board.h file, which has the declaration of the function in question:
#ifndef BOARD_H_
#define BOARD_H_
#ifdef __cplusplus
extern "C"
{
#endif
#include <asf.h>
#include "SPI.h"
/* Typedefs */
//typedef void (*P_EVENT_HANDLER)(void* pValue);
/* Pins */
#define nHIB_PIN IOPORT_CREATE_PIN( PORTD, 7 )
#define CC3120_INT_PIN IOPORT_CREATE_PIN( PORTD, 6 )
#define CC3120_RESET_PIN IOPORT_CREATE_PIN( PORTA, 1 )
#define CC3120_SLAVE_PIN IOPORT_CREATE_PIN( PORTE, 0 )
#define LED_BLUE IOPORT_CREATE_PIN( PORTA, 5 )
#define LED_GREEN IOPORT_CREATE_PIN( PORTA, 6 )
/* USART pins */
#define USARTC0_XCK IOPORT_CREATE_PIN( PORTC, 1 )
#define USARTC0_TXD IOPORT_CREATE_PIN( PORTC, 3 )
#define USARTC1_XCK IOPORT_CREATE_PIN( PORTC, 5 )
#define USARTC1_TXD IOPORT_CREATE_PIN( PORTC, 7 )
//#define USARTD0_XCK IOPORT_CREATE_PIN( PORTD, 1 )
//#define USARTD0_TXD IOPORT_CREATE_PIN( PORTD, 3 )
//#define USARTD1_XCK IOPORT_CREATE_PIN( PORTD, 5 )
//#define USARTD1_TXD IOPORT_CREATE_PIN( PORTD, 7 )
#define USARTE0_XCK IOPORT_CREATE_PIN( PORTE, 1 )
#define USARTE0_RXD IOPORT_CREATE_PIN( PORTE, 2 )
#define USARTE0_TXD IOPORT_CREATE_PIN( PORTE, 3 )
//#define USARTE1_XCK IOPORT_CREATE_PIN( PORTE, 5 )
//#define USARTE1_TXD IOPORT_CREATE_PIN( PORTE, 7 )
//#define USARTF0_XCK IOPORT_CREATE_PIN( PORTF, 1 )
//#define USARTF0_TXD IOPORT_CREATE_PIN( PORTF, 3 )
/* Functions */
void CC3120Disable( void );
void CC3120Enable( void );
uint8_t CC3120RegisterInterruptHandler( P_EVENT_HANDLER InterruptHdl , void* pValue );
void CC3120MaskIntHdlr( void );
void CC3120UnMaskIntHdlr( void );
void clock_init( void );
void init( void );
#ifdef __cplusplus
}
#endif
#endif /* BOARD_H_ */
The function is defined in board.cpp, here is the beginning of that file, up to where the function is:
#include <asf.h>
#include "board.h"
#include "socket.h"
/* Variables */
P_EVENT_HANDLER CC3120IrqHandler = 0;
uint8_t intIsMasked = 0;
/* Interrupt Handler */
ISR( PORTD_INT0_vect )
{
if ( CC3120IrqHandler && !intIsMasked )
CC3120IrqHandler( 0 );
}
void CC3120Disable()
{
ioport_set_pin_level( nHIB_PIN, false );
}
It's making me crazy, I can't figure out why it's throwing an implicit declaration error for that function. Can anybody see a problem or suggest something to try?

Error for structure definition in Visual C++

I am facing problem in structure definition which worked fine using gcc
now I want to compile same program in visual studio but some of the conventions are not matching. I have done some changes to the code but I can't figure it out where I am going wrong.
below code is from brg_types.h
#ifndef _BRG_TYPES_H
#define _BRG_TYPES_H
#if defined(__cplusplus)
extern "C" {
#endif
#include <limits.h>
#if defined( _MSC_VER ) && ( _MSC_VER >= 1300 )
# include <stddef.h>
# define ptrint_t intptr_t
#elif defined( __GNUC__ ) && ( __GNUC__ >= 3 )
# include <stdint.h>
# define ptrint_t intptr_t
#else
# define ptrint_t int
#endif
#ifndef BRG_UI8
# define BRG_UI8
# if UCHAR_MAX == 255u
typedef unsigned char uint_8t;
# else
# error Please define uint_8t as an 8-bit unsigned integer type in brg_types.h
# endif
#endif
#ifndef BRG_UI16
# define BRG_UI16
# if USHRT_MAX == 65535u
typedef unsigned short uint_16t;
# else
# error Please define uint_16t as a 16-bit unsigned short type in brg_types.h
# endif
#endif
#ifndef BRG_UI32
# define BRG_UI32
# if UINT_MAX == 4294967295u
# define li_32(h) 0x##h##u
typedef unsigned int uint_32t;
# elif ULONG_MAX == 4294967295u
# define li_32(h) 0x##h##ul
typedef unsigned long uint_32t;
# elif defined( _CRAY )
# error This code needs 32-bit data types, which Cray machines do not provide
# else
# error Please define uint_32t as a 32-bit unsigned integer type in brg_types.h
# endif
#endif
#ifndef BRG_UI64
# if defined( __BORLANDC__ ) && !defined( __MSDOS__ )
# define BRG_UI64
# define li_64(h) 0x##h##ui64
typedef unsigned __int64 uint_64t;
# elif defined( _MSC_VER ) && ( _MSC_VER < 1300 ) /* 1300 == VC++ 7.0 */
# define BRG_UI64
# define li_64(h) 0x##h##ui64
typedef unsigned __int64 uint_64t;
# elif defined( __sun ) && defined( ULONG_MAX ) && ULONG_MAX == 0xfffffffful
# define BRG_UI64
# define li_64(h) 0x##h##ull
typedef unsigned long long uint_64t;
# elif defined( __MVS__ )
# define BRG_UI64
# define li_64(h) 0x##h##ull
typedef unsigned int long long uint_64t;
# elif defined( UINT_MAX ) && UINT_MAX > 4294967295u
# if UINT_MAX == 18446744073709551615u
# define BRG_UI64
# define li_64(h) 0x##h##u
typedef unsigned int uint_64t;
# endif
# elif defined( ULONG_MAX ) && ULONG_MAX > 4294967295u
# if ULONG_MAX == 18446744073709551615ul
# define BRG_UI64
# define li_64(h) 0x##h##ul
typedef unsigned long uint_64t;
# endif
# elif defined( ULLONG_MAX ) && ULLONG_MAX > 4294967295u
# if ULLONG_MAX == 18446744073709551615ull
# define BRG_UI64
# define li_64(h) 0x##h##ull
typedef unsigned long long uint_64t;
# endif
# elif defined( ULONG_LONG_MAX ) && ULONG_LONG_MAX > 4294967295u
# if ULONG_LONG_MAX == 18446744073709551615ull
# define BRG_UI64
# define li_64(h) 0x##h##ull
typedef unsigned long long uint_64t;
# endif
# endif
#endif
#if !defined( BRG_UI64 )
# if defined( NEED_UINT_64T )
# error Please define uint_64t as an unsigned 64 bit type in brg_types.h
# endif
#endif
#ifndef RETURN_VALUES
# define RETURN_VALUES
# if defined( DLL_EXPORT )
# if defined( _MSC_VER ) || defined ( __INTEL_COMPILER )
# define VOID_RETURN __declspec( dllexport ) void __stdcall
# define INT_RETURN __declspec( dllexport ) int __stdcall
# elif defined( __GNUC__ )
# define VOID_RETURN __declspec( __dllexport__ ) void
# define INT_RETURN __declspec( __dllexport__ ) int
# else
# error Use of the DLL is only available on the Microsoft, Intel and GCC compilers
# endif
# elif defined( DLL_IMPORT )
# if defined( _MSC_VER ) || defined ( __INTEL_COMPILER )
# define VOID_RETURN __declspec( dllimport ) void __stdcall
# define INT_RETURN __declspec( dllimport ) int __stdcall
# elif defined( __GNUC__ )
# define VOID_RETURN __declspec( __dllimport__ ) void
# define INT_RETURN __declspec( __dllimport__ ) int
# else
# error Use of the DLL is only available on the Microsoft, Intel and GCC compilers
# endif
# elif defined( __WATCOMC__ )
# define VOID_RETURN void __cdecl
# define INT_RETURN int __cdecl
# else
# define VOID_RETURN void
# define INT_RETURN int
# endif
#endif
#define ALIGN_OFFSET(x,n) (((ptrint_t)(x)) & ((n) - 1))
#define ALIGN_FLOOR(x,n) ((uint_8t*)(x) - ( ((ptrint_t)(x)) & ((n) - 1)))
#define ALIGN_CEIL(x,n) ((uint_8t*)(x) + (-((ptrint_t)(x)) & ((n) - 1)))
#define UI_TYPE(size) uint_##size##t
#define UNIT_TYPEDEF(x,size) typedef UI_TYPE(size) x
#define BUFR_TYPEDEF(x,size,bsize) typedef UI_TYPE(size) x[bsize / (size >> 3)]
#define UNIT_CAST(x,size) ((UI_TYPE(size) )(x))
#define UPTR_CAST(x,size) ((UI_TYPE(size)*)(x))
#define u8 uint_8t
#define u32 uint_32t
#define u64 uint_64t
#if defined(__cplusplus)
}
#endif
#endif
Below code is within tables.h
#ifndef __tables_h
#define __tables_h
#include "brg_endian.h"
#define NEED_UINT_64T
//#include "brg_types.h"
#if (PLATFORM_BYTE_ORDER == IS_BIG_ENDIAN)
const u32 T[8*256] __attribute__((aligned(64))) {
/*some code*/
};
#endif /* IS_BIG_ENDIAN */
#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
const u32 T[8*256] __attribute__((aligned(64))) = {
/*some code*/
};
#endif /* IS_LITTLE_ENDIAN */
#endif /* __tables_h */
Above code got compiled with gcc compiler
in visual studio use of brg_types.h is done as it is
and tables.h was changed following
#pragma once
#ifndef __tables_h
#define __tables_h
#include "brg_endian.h"
#include "brg_types.h"
#if defined(_MSC_VER)
#define ALIGNED_(x) __declspec(align(x))
#else
#if defined(__GNUC__)
#define ALIGNED_(x) __attribute__ ((aligned(x)))
#endif
#endif
#define ALIGNED_TYPE_(t,x) typedef t ALIGNED_(x)
#pragma pack(1)
#define int8_t __int8
#define int16_t __int16
#define int32_t __int32
#define int64_t __int64
#define uint8_t unsigned __int8
#define uint16_t unsigned __int16
#define uint32_t unsigned __int32
#define uint64_t unsigned __int64
#if (PLATFORM_BYTE_ORDER == IS_BIG_ENDIAN)
const uint32_t T[8*256] ALIGNED_(64) = {
/*some code*/
};
#endif /* IS_BIG_ENDIAN */
#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
const uint32_t T[8*256] ALIGNED_(64) = {
};
#endif /* IS_LITTLE_ENDIAN */
#endif /* __tables_h */
Error thrown to me by visual studio is
Error 3 error C1903: unable to recover from previous error(s); stopping compilation
Error 1 error C2144: syntax error : 'int' should be preceded by ';'
Error 2 error C2513: 'int' : no variable declared before '='
near: const uint32_t T[8*256] ALIGNED_(64) = {
/*some code*/
};
Your problem is the ALIGNED_ macro. As it is currently defined, it needs to come before the declaration in VS, but after for GCC. The syntax you want to achieve is:
const uint32_t __declspec(align(64)) T[8*256] = // MSVC
const uint32_t T[8*256] __attribute__ ((aligned(64))) = // GCC
I think the solution is to pass the variable declaration to ALIGNED_, so that the usage looks like:
const uint32_t ALIGNED_(T[8*256], 64) = ...
The definition should look something like:
#if defined(_MSC_VER)
# define ALIGNED_(v, x) __declspec(align(x)) v
#elif defined(__GNUC__)
# define ALIGNED_(v, x) v __attribute__ ((aligned(x)))
#else
# error "Don't know how to define ALIGNED_"
#endif
Warning: This code has not been seen by any compiler. Assume it contains errors.
I don't know how to handle the definition of ALIGNED_TYPE because I can't see an example of its use.

cannot open file 'glew_static_vs2010.lib' and pragma comment

I'm trying to get started with a book about modern OpenGL. In the book, I need to link against some libs (i.e. freeglut glew32 vermilion32). I've downloaded the source code for glew and generated the lib. There is no problem with linking the libs I've generated but it seems the author uses pragma comment and it causes some linking errors.
LINK : fatal error LNK1104: cannot open file 'glew_static_vs2010.lib'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.EXE"' : return code '0x2'
In one of headers files (i.e. vgl.h) used in the code, there are these lines
#ifndef __VGL_H__
#define __VGL_H__
// #define USE_GL3W
#ifdef USE_GL3W
#include <GL3/gl3.h>
#include <GL3/gl3w.h>
#else
#define GLEW_STATIC
#include <GL/glew.h>
#ifdef _MSC_VER
# ifdef _DEBUG
# if (_MSC_VER >= 1600)
# pragma comment (lib, "glew_static_vs2010_d.lib")
# else
# pragma comment (lib, "glew_static_d.lib")
# endif
# else
# if (_MSC_VER >= 1600)
# pragma comment (lib, "glew_static_vs2010.lib")
# else
# pragma comment (lib, "glew_static.lib")
# endif
# endif
#endif
#endif
#define FREEGLUT_STATIC
#include <GL/freeglut.h>
#ifdef _MSC_VER
# ifdef _DEBUG
# if (_MSC_VER >= 1600)
# pragma comment (lib, "freeglut_static_vs2010_d.lib")
# else
# pragma comment (lib, "freeglut_static_d.lib")
# endif
# else
# if (_MSC_VER >= 1600)
# pragma comment (lib, "freeglut_static_vs2010.lib")
# else
# pragma comment (lib, "freeglut_static.lib")
# endif
# endif
#endif
#define BUFFER_OFFSET(x) ((const void*) (x))
#endif /* __VGL_H__ */
I don't know why the author is following this approach. How can I overcome this problem? This is my Makefile
CC = cl
CFLAGS = /EHsc /c
INCLUDES = \
/I D:\CPP_Projects\CommandPrompt\ModernOpenGL\Books\Opengl_Programming_Guide_8th\oglpg_8th_edition\include
LIBS = \
/LIBPATH:D:\CPP_Projects\CommandPrompt\ModernOpenGL\Books\Opengl_Programming_Guide_8th\oglpg_8th_edition\lib \
freeglut_staticd.lib glew32sd.lib vermilion32_d.lib
all: project
project: triangles.obj LoadShaders.obj
$(CC) /EHsc /Fetest.exe triangles.obj LoadShaders.obj \
/link $(LIBS)
triangles.obj: triangles.cpp
$(CC) $(CFLAGS) triangles.cpp $(INCLUDES)
LoadShaders.obj: LoadShaders.cpp
$(CC) $(CFLAGS) LoadShaders.cpp $(INCLUDES)
clean:
del *.exe *.obj
Microsoft compiler allows to use #pragma comment (lib, "libraryname.lib") to specify libraries that should be used by linker instead of passing them to linker on command line. Since you build your own libraries perhaps you should comment out these entire blocks for auto-linking from vgl.h (or even delete them):
#ifndef __VGL_H__
#define __VGL_H__
// #define USE_GL3W
#ifdef USE_GL3W
#include <GL3/gl3.h>
#include <GL3/gl3w.h>
#else
#define GLEW_STATIC
#include <GL/glew.h>
// #ifdef _MSC_VER
// # ifdef _DEBUG
// # if (_MSC_VER >= 1600)
// # pragma comment (lib, "glew_static_vs2010_d.lib")
// # else
// # pragma comment (lib, "glew_static_d.lib")
// # endif
// # else
// # if (_MSC_VER >= 1600)
// # pragma comment (lib, "glew_static_vs2010.lib")
// # else
// # pragma comment (lib, "glew_static.lib")
// # endif
// # endif
// #endif
#endif
#define FREEGLUT_STATIC
#include <GL/freeglut.h>
// #ifdef _MSC_VER
// # ifdef _DEBUG
// # if (_MSC_VER >= 1600)
// # pragma comment (lib, "freeglut_static_vs2010_d.lib")
// # else
// # pragma comment (lib, "freeglut_static_d.lib")
// # endif
// # else
// # if (_MSC_VER >= 1600)
// # pragma comment (lib, "freeglut_static_vs2010.lib")
// # else
// # pragma comment (lib, "freeglut_static.lib")
// # endif
// # endif
// #endif
#define BUFFER_OFFSET(x) ((const void*) (x))
#endif /* __VGL_H__ */