help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] [Fwd: `undefined reference` Error When Linking]


From: Marco Atzeri
Subject: Re: [Help-glpk] [Fwd: `undefined reference` Error When Linking]
Date: Mon, 26 Mar 2018 05:52:32 -0700
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 26/03/2018 01:39, Andrew Makhorin wrote:

-------- Forwarded Message --------
From: Lam Ling
Hi all,


I built and installed glpk 4.65 from source, and I can verify that it's
successfully installed to `/usr/local/lib`. But when I tried to compile
a C++ program with glpk using gcc 5.4.0 on Ubuntu 16.04, I got many
undefined reference errors on the glpk functions.


Here's the g++ command I used:


g++ -I/home/linuxbrew/.linuxbrew/Cellar/eigen/3.3.4/include/eigen3
-I/usr/local/include -lm -L/usr/local/lib -lglpk -Wall -Ofast -std=c++11
util.cpp main.cpp -o main


link order matters, try

g++ -I/home/linuxbrew/.linuxbrew/Cellar/eigen/3.3.4/include/eigen3
-I/usr/local/include -lm -L/usr/local/lib util.cpp main.cpp
-lglpk -Wall -Ofast -std=c++11 -o main



reply via email to

[Prev in Thread] Current Thread [Next in Thread]