Author Topic: Codeblocks trying to find a nonexistent library  (Read 3554 times)

Offline srjacob

  • Single posting newcomer
  • *
  • Posts: 2
Codeblocks trying to find a nonexistent library
« on: July 20, 2018, 10:44:26 pm »
I am having a strange problem and I don't really know how to search for it.

I am using code::blocks on the Raspberry PI.  I wrote a small test program and modified an existing GPIO class in order to get to the GPIO pins with a RGB matrix HAT/library that doesn't play well with others.

Anyway, I have the 4 attached programs plus the code::blocks files.  When I build them, the linker is looking for a GPIO.o file.  This file doesn't exist, but somehow Code::blocks wants to find it  I have searched everywhere I know looking for the reference to this file, but I can't find any reference.

Could someone please let me know where code::blocks keeps its file references so I can figure out this problem.  I have checked the Project->Build Options and Project->Properties, and can't find anywhere this rogue file is being referenced.

Thanks in advance.

Steve

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Codeblocks trying to find a nonexistent library
« Reply #1 on: July 20, 2018, 10:54:25 pm »
Remove GPIO.cpp from the project or add the file.

Edit: For problems like this I first try [Plugins] -> "Find broken files in project".

Tim S.
« Last Edit: July 20, 2018, 10:58:06 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline srjacob

  • Single posting newcomer
  • *
  • Posts: 2
Re: Codeblocks trying to find a nonexistent library
« Reply #2 on: July 21, 2018, 01:49:01 am »
Thanks.  GPIO.cpp was not in the project, so I couldn't remove it.  However, Plugins->Find broken files in project succeeded in removing both GPIO.cpp and GPIO.o from the project.  How do I find files in the project that have no .cpp files?

I am also getting placed on the link command the library "/home/pi/rpi-rgb-led-matrix/lib/librgbmatrix.a", but I can't find any reference in either the Project->Build options or in the Project->Properties.  Does Code::blocks hide this somewhere?

On the build, I am now getting:

-------------- Build: Debug in linktest (compiler: GNU GCC Compiler)---------------

g++ -L/home/pi/linktest/ -L/home/pi/linktest/ -L/home/pi/rpi-rgb-led-matrix/lib -o bin/Debug/linktest obj/Debug/ButtonSetup.o obj/Debug/main.o obj/Debug/SrjGPIO.o  -pthread -pthread  /home/pi/linktest/obj/Debug /home/pi/rpi-rgb-led-matrix/lib/librgbmatrix.a
/usr/bin/ld: cannot find /home/pi/linktest/obj/Debug: File format not recognized
collect2: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
2 error(s), 0 warning(s) (0 minute(s), 0 second(s))
 
I have gotten this before, and I am not sure why.  Could someone please enlighten me on why I am getting "File format not recognized."

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Codeblocks trying to find a nonexistent library
« Reply #3 on: July 21, 2018, 02:03:23 am »
Likely because you are using the wrong toolchain/linker/compiler.

Edit: Re-read your post more likely you added the wrong search path in the global compiler settings or in the project settings.

http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

Tim S.
« Last Edit: July 21, 2018, 02:06:18 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: Codeblocks trying to find a nonexistent library
« Reply #4 on: July 21, 2018, 04:22:11 am »
Please stop putting anything in the link libraries list except for the library name; till you learn more about Code::Blocks and your compiler.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org