Fixed! "Undefined reference to.." errors
FYI,
I had been experiencing "undefined reference to" problems in one of the programs I had been writing. I even tried to use the "-l" option when using gcc, but no luck. My fix? I changed the extension from ".cpp" to ".c". I have no clue why that worked, but it did... If anyone has an idea how or why that worked, feel free to post. :) |
------ *deleted* -----
|
I'm moving this to programming.. but I probably know why you had problems.
GCC decides what type of file you have based on the file extension. ".cpp" is a C++ file and ".c" is a C file. The problem probably was a result of you compiling a C++ file with gcc without passing the -lstdc++ option. This can be avoided by compiling C++ programs with the g++ executable instead. |
All times are GMT -5. The time now is 10:13 AM. |