Saturday, May 4, 2024
0
rated 0 times [  0] [ 0]  / answers: 1 / hits: 1865  / 2 Years ago, wed, january 5, 2022, 6:38:26

I have a C++ program that compiles and runs perfectly in Code Blocks. However when I try to compile it from the terminal using:



gcc -g main.cpp -o Main


I get a lot of undefined references:






And this is a screenshot of the program running in Code Blocks:





More From » command-line

 Answers
2

I figured out the problem. I didn't find the specific solution but I found a work around. Apparently the classes aren't being linked. So I put all the classes into the main file and it worked perfectly!


[#28388] Thursday, January 6, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
cisccla

Total Points: 66
Total Questions: 134
Total Answers: 115

Location: Croatia
Member since Fri, Sep 11, 2020
4 Years ago
;