Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6239581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:24:59+00:00 2026-05-24T11:24:59+00:00

I want to debug a program I wrote. Therefor I’d like to link it

  • 0

I want to debug a program I wrote. Therefor I’d like to link it using “-g -O0”. When I compile (using autotools Makefile) using

make CXXFLAGS=’-g -O0′

I get some errors:

libtool: link: g++ -O2 -g -O0 -I/opt/adolc-2.2.1/include -o oc_poly oc_poly-oc_poly.o
oc_poly-oc_p2p.o -L/opt/ipopt-3.9.3/lib/coin -L/opt/ipopt-3.9.3/lib/coin/ThirdParty
-L/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2 -L/usr/lib/i386-linux-gnu/gcc/i686-
linux-gnu/4.5.2/../../.. -L/usr/lib/i386-linux-gnu /opt/ipopt-3.9.3/lib/coin/libipopt.so
-llapack -ldl /opt/ipopt-3.9.3/lib/coin/ThirdParty/libcoinhsl.so /opt/ipopt-3.9.3/lib
/coin/ThirdParty/libcoinblas.so /opt/ipopt-3.9.3/lib/coin/ThirdParty/libcoinlapack.so
/opt/ipopt-3.9.3/lib/coin/ThirdParty/libcoinmumps.so -lpthread -lblas -lgfortran -lm
-lgcc_s /opt/ipopt-3.9.3/lib/coin/ThirdParty/libcoinmetis.so -L/opt/adolc-2.2.1/lib
/opt/adolc-2.2.1/lib/libadolc.so -Wl,-rpath -Wl,/opt/ipopt-3.9.3/lib/coin -Wl,-rpath
-Wl,/opt/ipopt-3.9.3/lib/coin/ThirdParty -Wl,-rpath -Wl,/opt/adolc-2.2.1/lib -Wl,-rpath
-Wl,/opt/ipopt-3.9.3/lib/coin -Wl,-rpath -Wl,/opt/ipopt-3.9.3/lib/coin/ThirdParty
-Wl,-rpath -Wl,/opt/adolc-2.2.1/lib
oc_poly-oc_p2p.o: In function OCP_P2P::get_bounds_info(int, double*, double*, int,
double*, double*)':
/home/christian/Dokumente/Uni/SA/ist/Berechnungen/Optimale Steuernug/IpOpt
/oc_p2p.cpp:162: undefined reference to
OCP_P2P::INF’

The mentioned symbol INF is a static class member defined in the class definition OCP_P2P.

If I omit the CXXFLAGS or set them to any optimization value of O1, O2, O3 or Os the linking works pretty well. I am using g++ 4.5.2.

Can anybody give me a hint, what’s going wrong here? How can I debug my program?

Thanks

Christian

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T11:25:00+00:00Added an answer on May 24, 2026 at 11:25 am

    A static class member variable needs a definition; even if it is initialised in the class definition that is only a declaration. In other words, you need to put

    const double OCP_P2P::INF;
    

    somewhere in a cpp file. Presumably when optimisation was turned on the use of the variable was optimised out.

    The official rule is that a definition is needed if the variable is used, according to the standard’s definition of used, which is basically if a pointer to the variable is taken, or if the variable is bound to a reference.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use remote debugging. The program that I want to debug runs
When using Google Chrome, I want to debug some JavaScript code. How can I
I want to debug TCP/IP interactions for a program I'm enhancing. I don't have
I want to debug the whole flow of a (Java) program. I see there
Is there a way to program using pure python in Xcode? I want something
I want to debug an application in Visual Studio but I ONLY have the
I want to debug a windows C++ application I've written to see why it
I want to debug an application in Linux. The application is created in C++.
I want to implement a simple debug log, which consists of a table into
I want to define some member variable and some code just in Debug Mode,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.