Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: ‘memset’ was not declared in this scope

I am trying to compile the complete example 8 provided at the end of this page: http://www.physics.wisc.edu/~craigm/idl/cmpfit.html

but I am getting this error: error: ‘memset’ was not declared in this scope

I have been looking how to solve this error and I saw that some people solved it by adding #include <string.h> to the head of the code. I tried it but I am still getting the same error.

I am using gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) on Ubuntu 12.04 LTS

I am trying to compile with:

g++ -o example example.cpp -lmpfit -lm
like image 325
Ángel Piñeiro Avatar asked Aug 31 '25 10:08

Ángel Piñeiro


1 Answers

If you use C you should include string.h

Otherwise, if you use C++ you should use cstring

C: #include <string.h>

C++: #include <cstring>
like image 67
Efstathios Chatzikyriakidis Avatar answered Sep 03 '25 03:09

Efstathios Chatzikyriakidis