Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

C++ error C3861: 'malloc': identifier not found

views
     
TSbzai123
post Nov 19 2008, 11:33 PM, updated 18y ago

Getting Started
**
Junior Member
56 posts

Joined: Jul 2008
QUOTE
#include "malloc.h"
#include "stdlib.h"
#include "stdafx.h"
#include "dos.h"
#include "stdio.h"
#include "process.h"
#include "windows.h"
#include "conio.h"
#include "omp.h"

#define N_THREADS  6
#define M  3
#define K  2
#define N  3

int main(int argc, char *argv[])
{
DWORD ThreadId[N_THREADS];
HANDLE ThreadHandle[N_THREADS];
LPSECURITY_ATTRIBUTES lpThreadAttributes = NULL;
DWORD stackSize = 0;
DWORD dwCreationFlag = 0;
int thread_num = 0;
  //create the thread
for(int numRow=0;numRow < K; numRow++)
{
  for(int numColumn=0; numColumn < N; numColumn++ )
  {
  struct dataPassingToThread *data = (struct dataPassingToThread *)  malloc(sizeof(struct dataPassingToThread));  data->numRow = numRow;
  data->numColumn = numColumn;
  data->thread_no = thread_num+1;
                                                                .
                                                                .
                                                                .
                                                                .
don't know why is the error occurred.......
could anyone help?
NOTE: currently using VS2005 with c++
thank you in advance......



CarrieB
post Nov 19 2008, 11:46 PM

Getting Started
**
Junior Member
54 posts

Joined: Nov 2008


what is the error?
snorlax
post Nov 20 2008, 01:09 AM

Sleeper
******
Senior Member
1,308 posts

Joined: May 2005
From: 127.0.0.1


Hmm...Shouldn't you be using new with c++ instead? And is your struct header file included?
dstl1128
post Nov 20 2008, 12:38 PM

Look at all my stars!!
*******
Senior Member
4,464 posts

Joined: Jan 2003
Probably caused by certain include files overpowering another include files - end up having malloc() definition being skipped by some accidental include-guard.

CarrieB
post Nov 20 2008, 04:07 PM

Getting Started
**
Junior Member
54 posts

Joined: Nov 2008


QUOTE(snorlax @ Nov 20 2008, 01:09 AM)
Hmm...Shouldn't you be using new with c++ instead? And is your struct header file included?
*
I think shouldn't be C/C++ problem. But, yes, my same question would be have you included the header file that define the struct? If yes, would you like to have multiple struct pointer for each and every row?

 

Change to:
| Lo-Fi Version
0.0176sec    0.60    5 queries    GZIP Disabled
Time is now: 17th December 2025 - 06:40 AM