David K
David K

Reputation: 1346

Visual Studio not finding included definition

I'm pretty rusty in C++, so forgive me for any stupid comments/questions. Right now I'm working in Microsoft Visual C++ 2010 Express. I have two files - a source and a header - and VS is recognizing the header file when I include it, but it cannot find any definitions from within the header file. It shows me 'Error: identifier "RAW_PACKET_SIZE" is undefined'. The code was provided as a sample to work with a device's API, so it should work. I'm assuming the problem is with the VS setup. Here's some intro code form each:

recorder.cpp

#include <vector>
#include "APIW32.h"
#pragma comment(lib,"APIW32.lib")

int devID;
float* buf = new float[RAW_PACKET_SIZE];  // error is here, at 'RAW_PACKET_SIZE'

APIW32.h

#pragma once

#ifdef EXPORTS
#define API __declspec(dllexport)
#else
#define API __declspec(dllimport)
#endif

#define MIN_BW                0.301003456
#define MAX_BW                10100000
#define RAW_PACKET_SIZE       299008

UPDATE:

It appears that the error was only appearing in Intellisense, and not as an actual build error. Moral of the story - Intellisense is not always right!

Upvotes: 0

Views: 735

Answers (1)

Matt
Matt

Reputation: 74

Try float* buf = new float[RAW_PACKET_SIZE];

Upvotes: 2

Related Questions