I am coding in C an optimization problem on linux. I am using CPLEX to solve this optimization problem.
I wrote my code and everything, but when i'm trying to compile in the terminal, I am getting such errors:
etc.... I am trying to change in my code the CPX to CPXX but still
I have a 64-bit machine
model.c is the name of my C file.model.c:(.text+0x115c): undefined reference to "CPXnewrows"
model.c:(.text+0x121b): undefined reference to "CPXchgcoeflist"
model.c:(.text+0xd62): undefined reference to "CPXnewcols"
Please any help would be more than grateful!!!
Those are linker errors. You need to link the CPLEX library with model.c.
This link might have some applicable information on how to do this on Linux.
Related
We are porting an application from HPUX to Linux using Microfocus COBOL and GNU C on both platforms.One of our shared libraries is failing at runtime with the following error:
AB123: symbol lookup error. libRTS.so: undefined symbol: _mFldhandle
My understanding is that _mFldhandle is internal to Microfocus.
Can anyone point me to why we might be having an issue / what we should be including to make sure _mFldhandle is available at runtime?
Thanks!
Contrary to the comments from above the usual reason for this symbol being missing is not using "cob" to link your exe or shared object.
The other reason is not using the same 'C' compiler that the product was created with.
I have a problem much like the one here where the error is "Undefined reference to sqrt". I understand how using the -lm flag when compiling fixes the problem by linking it to the math library, however, are there any other possible ways to fix the problem without using any special compiler flags?
I've been happily using "-lm" while compiling my project so far, but my instructor uses try which won't accept a submission unless it compiles.... they do not use -lm.
Is there a way to solve this that doesn't require me to write my own square root function?
Other than making your own sqrt method no, though some compilers have the sqrt function already in them from what I've used so you may not need the extra flag potentially. I would email your instructor and talk to him about this.
I am trying to compile some source code and I am having issues. The code is written in C and FORTRAN and I am running into an issue with my compilers going from one to the other. This is the error message being returned;
mod_par.o: In function `__mod_par_MOD_domdec':
mod_par.f90:(.text+0x35a47): undefined reference to `partition_'
collect2: error: ld returned 1 exit status
make: *** [fvcom] Error 1
This is what I believe to be the offending bit of code from the file mod_par.F;
# if !defined (PARTITION_SPECIAL)
So I have been advised that this is a common problem encountered due to different naming conventions in C and FORTRAN. I have been give some advice on how to go about solving the problem, however, I don't understand the advice. It is as follows;
1) Work out which library hosts this partition function
2) Read through the docs for that library to find out how to generate a fortran wrapper library
3) Make sure you link through to the wrapper library as well as the original library
Anyone able to put this into laymans terms for me/advise on how to proceed/point me on to info to help me proceed? Let me know if you need anymore info.
I actually resolved this the issue was that I was building the application using mpi compilers and the METIS library that was required for a parallel build was not linked. I linked this and the application is now built. – deiniol
I have a problem much like the one here where the error is "Undefined reference to sqrt". I understand how using the -lm flag when compiling fixes the problem by linking it to the math library, however, are there any other possible ways to fix the problem without using any special compiler flags?
I've been happily using "-lm" while compiling my project so far, but my instructor uses try which won't accept a submission unless it compiles.... they do not use -lm.
Is there a way to solve this that doesn't require me to write my own square root function?
Other than making your own sqrt method no, though some compilers have the sqrt function already in them from what I've used so you may not need the extra flag potentially. I would email your instructor and talk to him about this.
In my Turbo C++ program, I can't run any of the graphics program. When it compiles, it shows an error like:
undefined symbol _line, _closegraph,_ getmaxx etc...
Is it due to the settings of my c-program?
Is this an old program that was written for Turbo C++, and that you're trying to compile with a modern compiler? If so, it might be the case that the program uses compiler-specific extensions and libraries, that are simply not available in the compiler you're using now.
If that is the case, you must either
find an existing library for your current environment that emulates the old Turbo C++ one, or
find out exactly what each call is supposed to do, and change the code to use something that your environment supports.
It's compile error and not link error. Looks like "graphics.h" is missing.
Do
#include "graphics.h"
Those errors are typical of a missing library in your build. Try linking the appropriate libraries and rebuild the solution (most likely graphics.lib).
-John
If the problem is of compiling error then you may add the header file:
#include<graphics.h>
if the problem still persists then make sure you have added the header file:
#include<dos.h>