Solved How to troubelshoot collect2: error: ?
-
"on line help" indicates this MAY be repose to previous errors.
I run "clean" and "rebuidl" and still getting this AND ONLY this error.
It started after I added "existing files" - none of them are currenlty used during buidl.:-1: error: collect2: error: ld returned 1 exit status
-
Because using the same file name twice in the same build scope will generate duplicated commands as the warning you had suggests. Your "empty" main was the last one and thus used and since it was not containing any code, there were missing bits.
-
Hi,
You need to provide the lines previous to this one. There's not enough information to diagnose what is happening.
-
Thanks for reply.
This is the only real error I get.I am getting tons of warnings , but my app runs as expected ( when I have no errors ) warnings do not bother me right now.
PS.
Is there a way to capture / print all "issues" as text ?
(QtCreator) -
I did "back-up" to my previous project version and now I am getting only this:
I did add some existing files - including another main.cpp, BUT I have bypassed both main.cpp and main .h.
My next attempt to resolve will be to physically delete the extra main files.
SOLVED
Deleting the extra main.cpp solved the issue .
Still not sure why simply bypassing the entire file contents ( #ifdef BYPASS ...#endif) created the problem . -
Because using the same file name twice in the same build scope will generate duplicated commands as the warning you had suggests. Your "empty" main was the last one and thus used and since it was not containing any code, there were missing bits.
-
True, however, I did same (#ifdef BYPASS... #endif) for other files and received unclassified ( no error nor warning) message saying effectively the "class" could no be build. Since "main" is not a class it makes sense.
I'll shall try same stunt in plain C++ when I am done with Qt, however in IDE I can selectively bypass / not compile any file.
It would be nice and cleaner to do such in QCreator.
On the other hand - how many developers import a file and not use it?