Post

Replies

Boosts

Views

Activity

ld: symbol(s) not found for architecture arm64, linking issue
I have just starting coding in my new mac. But whenever i make a program that contains other program files to link. It always shows this arm64 architecture error, i am unable to resolve it. For ex: These are the programs i am trying to create: //my.cpp #include "my.h" #include <iostream> using namespace std; void print_foo(){ cout<<foo<<"\n"; } void print(int i){ cout<<i<<"\n"; } //my.h #ifndef MY_H #define MY_H extern int foo; void print_foo(); void print(int); #endif //MY_H //user.cpp #include "my.h" int main(){ foo = 7; print_foo(); print(99); } and this is my Makefile program output: user.o my.o g++ user.o my.o -o output user.o: user.cpp g++ -c user.cpp my.0: my.o my.h g++ -c my.cpp clean: rm*.o output This is the output i am getting on running the program:
2
1
3.8k
Nov ’22
clang: error: linker command failed with exit code 1
I was doing the 12th chapter in Bjarne's 2nd edition of "Programming: Principles and Practices using C++" in which i have to install Fltk and alo use many other header files in the project. I successfully installed Fltk and build it but i don't know how to link the Fltk file and other necessary file in a single project. I have tried a lot of things but nothing is working. The code i wanna run is this: #include "Simple_window.h" #include "Graph.h" int main() {   using namespace Graph_lib;      Point tl {100,100};      Simple_window win {tl,600,400,"Canvas"};         Polygon poly;      poly.add(Point{300,200});   poly.add(Point{350,100});   poly.add(Point{400,200});      poly.set_color(Color::red);      win.attach (poly);      win.wait_for_button(); } This is my project and the files i have tried to link and failed: And this is what i am getting as the error, even after lot of searching on the internet, i can't figure out how to solve this issue: pls tell me what i am doing wrong, i am very new to Xcode. Also if there is another way to make the program without Xcode, then that will help too. Even though i got the same error while making the program using Make.
0
0
6.1k
Jan ’23
library not found for -lpng, clang: error: linker command failed
I am trying to make a c++ program using fltk library and some additional files, but i am getting this error again and again, i used the command shown in the picture and have checked that i have libpng file installed. I can't figure out how to solve this issue. Pls help, this is the first time i have installed a library for the 12th chapter in Bjarne's 2nd edition of "Programming: Principles and Practices using C++". I am stuck on this linking issue for days and can't get my program to run. The program i am trying to run is this: #include "Simple_window.h" #include "Graph.h" int main() { using namespace Graph_lib; Point tl {100,100}; Simple_window win {tl,600,400,"Canvas"}; Polygon poly; poly.add(Point{300,200}); poly.add(Point{350,100}); poly.add(Point{400,200}); poly.set_color(Color::red); win.attach (poly); win.wait_for_button(); } I am getting the same issue in Xcode.
3
0
1.4k
Jan ’23