You need to pass -library to gcc instead of library.so ,also provide library.so's location
gcc -L/path/to/library.so -o test.o -llibrary -ldl -lpthread -lm
Answer from Rahul R Dhobi on Stack OverflowReceived errors about undefined reference to min
linux - Compile error with max_min.c:(.text+0x3c): undefined reference to `max_func' - Stack Overflow
build fails with `undefined reference to `major'`
compiling - Undefined reference to math functions when linking with gcc - Unix & Linux Stack Exchange
i get this error:C:\Users\Owner\MadV\main.cpp|873|undefined reference to `BigNum::operator++(int)'|
when i try to use functions from my BigNum.c files, the functions have been declared in BigNum.h, these are my main.cpp includes:
include <cmath> include <stack> include<queue> include <iostream> include <ranges> include <regex> include <vector> include <thread> include <bitset> include <ctime> include <iterator> include <math.h> include <bits/stdc++.h> include "vytecode.h" include "debugger.h" include "vytemachine.h" include "BigNum.h" // never incude .c/cpp files include <time.h> define M_PI 3.141592653589793 include<windows.h> include <SFML/Graphics.hpp> include <map> include <chrono> include <GL/gl.h> include <string> define gkey GetAsyncKeyState define rxs regex_search define rxp regex_replace define rxm regex_match define icas std::regex_constants::icase include <immintrin.h>
is there any thing causing this in the guards? in the BigNum.h file i have pragma once, so i don't think that should be causing any errors.
definition of functions in my BigNum class( in BigNum.h):
inline BigNum operator+( BigNum &other) ;
inline BigNum operator-( BigNum &other) ; // dont change to * bc its slower
inline BigNum operator*( BigNum other) ;
inline BigNum operator/( BigNum other) ;
inline void operator++(int);
inline void operator--(int);
inline bool operator>(const BigNum& other) const;
inline bool operator<(const BigNum& other) const;
inline bool operator>=(const BigNum& other) const;
inline bool operator<=(const BigNum& other) const;
inline bool operator==(const BigNum& other) const;
inline bool operator!=(const BigNum& other) const;
code that fails to compile(main.cpp):
BigNum test("1");
BigNum c ("32.5");
BigNum f("1.5");
double c2 = 5.2433423412;
int k2 = 10;
int f2;
testBool* x2;
x2 = new testBool[10000000];
auto t1 = std::chrono::high_resolution_clock::now();
for(auto i = 0; i<= 1e+7;i++)
{
c+f;
}
auto t2 = std::chrono::high_resolution_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>( t2 - t1 ).count();
print(c,0);
setInt(c);
print(c,0);
std::cout<<"object: "<<duration<<std::endl;
return 0;