Author Topic: Linking to library files  (Read 7064 times)

Offline codie

  • Single posting newcomer
  • *
  • Posts: 8
Linking to library files
« on: March 16, 2010, 05:27:12 pm »
I'm trying to compile an imported DevCpp (circa 2004) routine.  I keep getting this message and the compiler stops because (I assume) it can't find the libmsimg32.a and libwinmm.a files.  But, I've copied them into the .obj subdirectory, added that directory to the linker search pass, plus linked those two library files ... in the build options window.

Compiling: GameEngine.cpp
Compiling: UFO.cpp
Compiling: UFO.rc
Compiling: Bitmap.cpp
Linking executable: UFO.exe
mingw32-g++.exe: /Dev-Cpp/lib/libmsimg32.a: No such file or directory
mingw32-g++.exe: /Dev-Cpp/lib/libwinmm.a: No such file or directory
Process terminated with status 1 (0 minutes, 4 seconds)
0 errors, 0 warnings

How can I force the compiler to see those two files other than what I've already tried (but failed)?   (it seems to want to find them in a path with Dev-Cpp/lib/ in it.  I tried making a subdirectory with that name in the search path but that didn't work either)

This is a game program I'm playing with to learn more about C++.  It comes from a book by Micheal Morrison.  I've fixed other compiling problems with the TransparentBlt() method and some other issues but this one's got me stumped.  I'm sure if I fix this issue another one will pop up ... I hope not ... I try to be optomistic.

thanks for any info I can get

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Linking to library files
« Reply #1 on: March 16, 2010, 05:39:24 pm »
Turn on Full Compiler logging and post build log after a re-build.
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

Best guess you have the path entered with library name in project config.

Edit: Where to check:
Project -> Build Options
Tab Linker Settings (Check for each target/project)
Block "Link Libraries"
Check for "Dev-Cpp" in name change to library name only.

Project -> Build Options
Tab Search Directories  
Sub-Tab Linker
Add correct library path to correct  target/project

Tim S.
« Last Edit: March 16, 2010, 05:53:39 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 codie

  • Single posting newcomer
  • *
  • Posts: 8
Re: Linking to library files
« Reply #2 on: March 16, 2010, 11:43:26 pm »
Thanks many times over.

I think your suggestion helped because now I don't get the "can't find" message for the two library files.

But my TransparentBlt error is back.

I hope I turned on the full error log you recommended.  Here's what I get about the TransparentBlt error:

Build started on: 16-03-2010 at 17:20.40
Build ended on: 16-03-2010 at 17:20.43
-------------- Build: default in UFO ---------------
mingw32-g++.exe -c "C:\Documents and Settings\john_m\My Documents\CodeBlock\UFO2\GameEngine.cpp" -o .objs\GameEngine.o
mingw32-g++.exe -c "C:\Documents and Settings\john_m\My Documents\CodeBlock\UFO2\UFO.cpp" -o .objs\UFO.o
windres.exe -i C:\DOCUME~1\john_m\MYDOCU~1\CODEBL~1\UFO2\UFO.rc -J rc -o .objs\UFO.res -O coff
mingw32-g++.exe -c "C:\Documents and Settings\john_m\My Documents\CodeBlock\UFO2\Bitmap.cpp" -o .objs\Bitmap.o
C:\Documents and Settings\john_m\My Documents\CodeBlock\UFO2\Bitmap.cpp: In member function `void Bitmap::Draw(HDC__*, int, int, BOOL, COLORREF)':
C:\Documents and Settings\john_m\My Documents\CodeBlock\UFO2\Bitmap.cpp:218: error: `TransparentBlt' was not declared in this scope
Process terminated with status 1 (0 minutes, 2 seconds)
1 errors, 0 warnings

If this isn't what you mean let me know.  I turned on full command line reporting via the settings pop menu.

I thought I had fixed the TransparentBlt problem but NOT.  I've read many things on the web about issues with this routine. 

Any help is greatly appreciated ... I'm a newb to C++ ... I know a little more about VB.net but not much.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Linking to library files
« Reply #3 on: March 17, 2010, 03:28:11 am »
FYI:

This is NOT a site to help with coding issues not related to Code::Blocks.
Suggest asking at a programming support site.

Edit: I think it is unrelated to your problem; but, using spaces does not work with all version of MinGW GCC and the windres is command with more problems with spaces than gcc or g++ commands.

Tim S.
« Last Edit: March 17, 2010, 03:42:11 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 MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Linking to library files
« Reply #4 on: March 17, 2010, 07:02:48 am »
I don't get it: Why are people that lazy today and don't just try to search their selves for a minute?
Googleing took me 5 seconds and revealed this:
http://www.google.com/search?hl=en&safe=off&rlz=1G1GGLQ_ENZZ326&q=%60TransparentBlt%27+was+not+declared+in+this+scope&btnG=Search&aq=f&aqi=&aql=&oq=&gs_rfai=

Posting the question here takes way more time and disrespects our forum rules. :shock:

Topic locked.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ