CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   SU2 Installation (http://www.cfd-online.com/Forums/su2-installation/)
-   -   Compilation problem when including C file (http://www.cfd-online.com/Forums/su2-installation/117160-compilation-problem-when-including-c-file.html)

mcell May 3, 2013 07:41

Compilation problem when including C file
 
2 Attachment(s)
Hi,

I want to couple SU2 with MpCCI (a coupling software) in order to make aeroelastic simulations with Nastran. MpCCI provides a C interface so I need to include some C headers in SU2_CFD.hpp and add some functions in SU2_CFD.cpp.

My problem is to compile the whole program. I already included for test reasons a c++ file and compiled it successfully (added lines for *hpp and *cpp file in Makefile.in and Makefile.am in the SU2_CFD/obj directory and used afterwards the configure file to create a new Makefile). If I do exactely the same with an external C file I get a compilation error after the object files are created. For test reasons I just tried to include a very simple C file which is located in SU2_v2.0.2/trunk/MpCCI_Adapter:

/*SU2_CFD.hpp*/
...
extern "C" {
#include "../../MpCCI_Adapter/data.h"
}

/* data.h */

#include <stdio.h>
void SayHello();

/* data.c */

#include "data.h"
void SayHello(){
printf("C header file included");
}

/* SU2_CFD.cpp */

...
SayHello();
...


I also tried to use the following command using the configure file, which didn't change anything:
--includedir=/home/tesla/work/Manuel/SU2_v2.0.2/trunk/MpCCI_Adapter

It is quite easy to find in the internet a solution for how compiling one c++ and one c file. But as I am very new to compiling it feels for me impossible to change these complex makefiles to fit my needs! I just saw that you also include an external C file (metis.h), but wasn't able to figure out what I have to change in the makefile in my case.

I would be very thankful if someone can help me with this problem!

I attached the error message and the makefiles.

Manuel

economon May 9, 2013 14:20

Hi Manuel,

At the moment, we don't have any experience in compiling SU2 with the MpCCI software. However, I would like to mention that SU2 can still be compiled using plain old makefiles rather than the autoconf/automake system, if a user would really like to do so. The original makefiles should still exist in the config/ directory for each module, i.e. SU2/SU2_CFD/config/. As a warning, these may be out of date, but it seems that you will probably need to update them anyway to accommodate the new external dependency.

Hope this helps!
Tom

mcell May 13, 2013 06:29

Hey Tom,
thank you! This makefile seems to me to deal with much easier. I'll try my best :)


All times are GMT -4. The time now is 03:05.