Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29400 Discussions

using *.cpp suffix instead of *.c suffix

tcurry
Beginner
930 Views
Hello,
I have the fortran calling a C function working properly. I want to be able to include some simple C++ classes within my C code so I renamed my file with a *.cpp suffix. Now, I cannot get the linker to find my function anymore in my *.cpp file. Do I have to declare something different now that I am using a *.cpp filename? Maybe I have to do something different with the underscores.

Thanks,
Tim
0 Kudos
1 Reply
Steven_L_Intel1
Employee
930 Views
If you use .cpp then C++ name mangling is applied - use

extern "C"

to name your routines and disable name mangling.

Steve
0 Kudos
Reply