Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic malloc() and free() not compiling (Read 2275 times)
Vidar
Newbies
*
Offline


Posts: 1
Joined: Nov 23rd, 2015
malloc() and free() not compiling
Nov 23rd, 2015 at 5:48pm
Print Post  
Hi,
I have an existing sketch that I have worked with on Atmel Studio. Since MS has released the community edition of VS, I decided to switch over. However, the sketch does not compile due to errors on the malloc() and free() macros Is this a known bug?
The code that fails looks like this:

Code (C++)
Select All
void PlotBuffer::init(uint16_t buf_length){
	int x = sizeof(byte)*buf_length;
	data = (byte*)malloc((buf_length*sizeof(byte)));
	//data = (byte*)malloc(x);
	capacity = buf_length;
	for(int16_t i = 0;i<capacity;i++){
		data[i] = 0;
	}
	head = 0;
	tail = 0;
	full = false;
}

void PlotBuffer::deAllocate(){
	free(data);
}
 

 

Edit: The error generated on both malloc and free in VS2015 with the latest Arduino for Visual Studio are: Error: Too many arguments on function call.
« Last Edit: Nov 23rd, 2015 at 8:26pm by Vidar »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: malloc() and free() not compiling
Reply #1 - Nov 23rd, 2015 at 8:42pm
Print Post  
Hi,

Please switch on "Visual Micro>Verbose" and then build. Email the output to info[at]visualmicro.com or post it.

Also confirm if the same problem happens if you switch the toolbar configuration from "Debug\Local windows debugger" to "Release" , then build again

Thanks
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint