[Ipopt] A Problem cpp_example.cpp

Brad Bell bradbell at seanet.com
Fri Jan 22 10:28:12 EST 2010

In the directory
when I enter the command
I get the response:

g++ -g -pipe -pedantic-errors -Wimplicit -Wparentheses -Wreturn-type 
-Wcast-qual -Wall -Wpointer-arith -Wwrite-strings -Wconversion 
-Wno-unknown-pragmas -DCHECK_SMARTPTR -I`echo 
/home/bradbell/prefix/ipopt/include/coin` -c -o cpp_example.o 
cpp_example.cpp: In function ‘int main(int, char**)’:
cpp_example.cpp:30: error: ‘printf’ was not declared in this scope
cpp_example.cpp:39: error: ‘printf’ was not declared in this scope

I am using:

[bradbell at localhost Cpp_example]$ gcc --version
gcc (GCC) 4.4.2 20091222 (Red Hat 4.4.2-20)

It seems to me that one should add
# include <cstdio>
and change the printf calls to std::printf calls.

Alternatively, one could add
# include <stdio.h>
and leave the printf calls as they are.

More information about the Ipopt mailing list