LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   IDE Troubles. Errors that don't exist. (https://www.linuxquestions.org/questions/programming-9/ide-troubles-errors-that-dont-exist-4175722171/)

jmgibson1981 02-18-2023 12:07 PM

IDE Troubles. Errors that don't exist.
 
Using Codeblocks on the my source found here

https://gitlab.com/jmgibson1981/mycp...les/File%20Ops

It fails with 2 errors to even compile in CodeBlocks. The first error is
Code:

line 58 multiple definition of `file_search_func';obj/Debug/mycprogress/Source Files/File Ops/fileprocess.c
and followed by this

Code:

error: ld returned 1 exit status
I chased my tail with this for awhile. Then for some reason I compiled manually with gcc in the terminal, same options
Code:

-Wall -O1
and it compiled without a word. My function works just fine. I cannot explain the failure to build at all or why this failure is limited to CodeBlocks.

I thought I might have some cruft in the project folder, so I created a new project and imported these 2 source files. Same result. I'm at a loss. I like the IDE, it helps me find my syntax errors (which are thankfully getting fewer and fewer) but this just baffles me. Especially considering it's set to use GCC... I just don't get it.

jailbait 02-18-2023 03:07 PM

My guess is that Codeblocks is mishandling the spaces that you have in: `file_search_func';obj/Debug/mycprogress/Source Files/File Ops/fileprocess.c

Perhaps you could put in escape characters that are recognized by both C and Codeblocks if there is such a thing.

Or if the names aren't set in stone yet you could use underlines instead of spaces.

jmgibson1981 02-18-2023 04:33 PM

I'm assuming you are talking about the path folders? If so then it made no change. changed them to lowercase _ separated names.

I may try to build on Windows, if only to see if that changes anything. It is an odd one.

*EDIT*

Same issue on Windows, slightly different wording. However in Visual Studio Code back on my kubuntu side it compiles and debugs clean.

ntubski 02-18-2023 09:10 PM

Plausible answer at: https://stackoverflow.com/questions/...-in-codeblocks

Quote:

Originally Posted by podgyhodgy
when adding a file in codeblocks using file - new etc there is a screen which asks if you want to include the file in debug and release versions. you innocently answer yes by ticking the boxes. the result is the file is automatically included and when you explicitly include it yourself you end up duplicating. so, dont tick those boxes.


NevemTeve 02-18-2023 10:08 PM

Remove this line from your mylibs.h file:
Code:

#include "fileprocess.c"
Only *.h files are mean't to be included into other files.

jmgibson1981 02-20-2023 05:01 PM

Well played. Thank you much. Worked just perfectly. So it will automatically check for the functions in any file in the project?

NevemTeve 02-20-2023 10:00 PM

I would start here: https://en.wikipedia.org/wiki/Linker_(computing)


All times are GMT -5. The time now is 01:35 AM.