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 6160787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:21:51+00:00 2026-05-23T21:21:51+00:00

I am trying to compile a .cpp-file which uses a matrix-library. The library-files libnewmat.a

  • 0

I am trying to compile a .cpp-file which uses a matrix-library. The library-files libnewmat.a and libnewmat.so are in the path /usr/lib64 . The include-files are in path /usr/include/newmat , so I tried (several ways) to compile i.e. with:

g++ -I/usr/include -L/usr/lib64 -lnewmat new.cpp -o new3

but the compiler doesn’t find the library. The content of the .cpp is:

#include <iostream>
#include <newmat/newmat.h>
#include <newmat/newmatio.h>

using namespace std;

int main()
{
Matrix A(2,2);
Real b[] = {1,2,3,4};
A << b;

cout << A << endl;

return 0;
}

The compiler says:

test.cpp: In function ‘int main()’:
test.cpp:9: error: ‘Matrix’ was not declared in this scope
test.cpp:9: error: expected ‘;’ before ‘A’
test.cpp:10: error: ‘Real’ was not declared in this scope
test.cpp:10: error: expected ‘;’ before ‘b’
test.cpp:11: error: ‘A’ was not declared in this scope
test.cpp:11: error: ‘b’ was not declared in 

this scope

Could You provide me with the correct c++ code, or the correct command line instruction?

Thanks, Kepler

  • 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-23T21:21:52+00:00Added an answer on May 23, 2026 at 9:21 pm

    This isn’t a library problem – it’s a compiler problem – it can’t find any definition for Matrix (probably in your include files, but we can’t determine that with the information given)

    [edit]
    Ascertain if your classes in the include files are being referenced correctly
    [/edit]

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

Sidebar

Related Questions

I'm trying to create a make file which will compile all the .cpp files
When trying to compile a file that include winnt.h via windows.h, I get the
I'm trying to share the same variable between two .cpp files, they include the
I have 3 files in my program: App_interface.h, App_interface.cpp, main.cpp. Im trying to compile
While trying to compile my project, that uses some third party headers, with mingw
I'm trying to compile an executable (ELF file) that does not use a dynamic
I have this C++ file (let's call it main.cpp ): #include <string> #include main.y.c
I've been trying to make some applications which all rely on the same library,
I'm trying to work on a cross-platform project that uses boost for the file/directory
I'm trying to compile a small OpenCV program using Eclipse. I'm limited in library

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.