SCIP makefile for c++ - makefile

I am beginner in using SCIP. I want to solve a simple MILP written in C++. I developed a simple makefile to compile and run my model but I realized there many nested header files when you call SCIP. I was wondering there might be a sample makefile to solve MILPin C++ using SCIP.
Thanks

You can use a makefile from one of the SCIP examples, e.g. scip/examples/TSP/Makefile. The C++ files of your project should be then added to the MAINOBJ variable.

Related

Fortran error: (.text+0x0): multiple definition of

I tried to include my Fortran modules in an extensive library that is also written in Fortran. To compile and install this library, the autotools suits are used. I made a Makefile to compile separately (in another directory and explained here) my modules and check if they were running fine. The test was successful. However, when I tried to couple them with this extensive library, I had trouble. I think, but not sure, that the problem is coming from the fact that in some of my subroutines, another subroutine is called several times. I have an error as follows:
DirectoryA/.libs/A.o: In function `__A_MOD_sub1':
A.F90:(.text+0x0): multiple definition of `__A_MOD_sub1'
DirectoryA/.libs/A.o:A.F90:(.text+0x0): first defined here
I tried to couple a very simple module with this library to make sure that the problem is not coming from how I modified the makefiles. This test was successful. In that simple module, I made just some subroutines printing some parameters.
In the new slightly complicated set of modules, I knowingly call a subroutine several times inside of another subroutine to perform a desired task. Is that where the problem comes from? Shall I add a flag to configure.ac in order to circumvent this issue?
I added LDFLAGS="${LDFLAGS} -Wl,--allow-multiple-definition" to the configure.ac file and the problem is solved.

How can I hook the preprocessor in Clang, XCode, and MSVS? (GCC works)

I'm using an external preprocessor (pyexpander) for my cross-platform/cross-IDE c++ project*. GCC already works nicely with the -no-integrated-cpp -B${PWD} option. I could manually preprocess each file into a specific temp dir, then compile the processed files. But is there a better way? Specifically, I'd love to hook the native preprocessors so IDE-level code analysis is happy (code completion and error checking). Any hints how I can achieve this would be much appreciated.
*"But why not use c++ macros?" They can't do macro-macros and I need that.
*"But why not use m4?" Because python happens to already be a requirement for this codebase, and m4 seems to not come with MSVS and thus would be yet another requirement/point of failure. I would still have to resolve the original preprocessor problem.
*"But why not use language something_better?" Because I have no choice in the matter. (Though I would love to use nim all the way!!)

how to generate makefile for a C source file

I've never tried to do this before so this is actually my first time to cross compile a C program.
I have a main.c code file and need to create a makefile for it so i can cross compile this file. This c file has a dependancy curl library. When I compile it in xcode by adding a library, it builds fine. However,i still need to create a makefile for the cross compiling. Can I generate that makefile with xcode? If so, can you please provide some step to step guidance or do i need to use another tool to generate it?
Alternative approach
You can use CMake for this task. First of all take a look at this tutorial, that explains CMake basics. Then take a look at toolchain documentation.
Take a look at this post too.
Btw OpenWrt has also support for CMake based projects, just look at uci and libubox packages.

library examples build in eclipse

I have C project of a library (using CDT). Configurations for both static and dynamic linking for several platforms. Several examples of the library usage is also included in the project. What is the best way to build these examples with the library? If I would like to build both the library and examples (linking the library just built) in one configuration?
I suppose I have to use custom makefile. Do I have to create makefile for the whole project (several of them, one for each platform), or is there any way how to include examples makefile to the automatic one?
Each example has only one source file, so the only things I need to do in my makefile are to determine which compiler is used, add some flags and link with the library which was built (I would include the make examples command as the post-build step).
As I didn't find any solution for this, I use custom makefile for the whole build. I also found a nice advice somewhere: if you want advanced build functions, use advanced build system.

Porting code from Linux to Windows

I'm using Visual Studio .NET 2003, and I'm trying to port code I've written and compiled/run successfully in Linux GCC to Windows.
I'm a newbie when using VS. I've created a new project, and added all the .c and .h files I have into the project by Project -> Add Existing Items, then chose all the .c and .h files.
I'm not familiar with how exactly compilers and linkers etc work, but is there a difference between how VS and gcc compile/link #include files? My habit of programming in Linux has been to have one main.c file, and #include all other .h or .c files that I need. Then I would only compile the main.c file. But in VS, it seems as if the #include files are not "seen" by the program, because I'm getting errors that tell me certain structures or variables were not declared, even though they are in my user-defined header files.
I'm also getting errors like DIR is an undeclared identifier. I've included , so why can't it recognize DIR?
Thank you.
Regards,
Rayne
Consider compiling your program with windows port of gcc (from Mingw32 or Cygwin) first. This will provide you with more familiar environment. If you'll still have to compile everything with VC++, you'll have more incremental process of porting.
Also, it is not evident from your post, but it seems you are trying to use dirent.h. Note that dirent.h (and corresponding libs) is not included with VC++.
One of the best ways to learn would be to start with the smallest application that you can compile on both. Expand this working and portable application step by step into the more fully featured application you desire.
Remember to add all .c/.cpp files to the 'Source Files' directory in the project as they won't be compiled otherwise.
Restrict any non-portable code (that you will need) to a single place. For example if you need to create threads, have a common create thread function used throughout (but implemented differently). Using portable libraries such as Boost can help here.

Resources