Author Topic: File dependencies using Code:Blocks IDE for windows  (Read 1011 times)

Offline fusion640

  • Single posting newcomer
  • *
  • Posts: 1
File dependencies using Code:Blocks IDE for windows
« on: October 16, 2022, 02:38:32 am »
I have a C program that I have written, but want to set up a GUI for user data entry using 64 bit windows. (not using the console window). Trying to learn some Win API stuff from Petzgold's book Programming Windows 5th edition (I also have the CD that came with it).  I am having quite a bit of trouble with the examples in the book with regards to dependencies. Can someone who has used the book point me to a source of information on how to properly set up Code:Blocks to work with the examples in the book (from the CD)?  I will admit to jumping the gun with my program just being a .c file, as I did not make it a project file to start with. I am an old geezer (65), self taught, not above groveling, previous hobby programmer with visual basic 4, but learned enough C to write a functioning program. Too old and desire not to learn C++ just to get a GUI.   

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5736
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: File dependencies using Code:Blocks IDE for windows
« Reply #1 on: October 16, 2022, 05:47:40 am »
Hi, there are many many tutorials on the internet, for example:

Windows GUI Programming with C/C++ ( Win32 API ) | Part -1 | Creating a window - YouTube

You can find even more tutorials. Hope that helps.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1254
Re: File dependencies using Code:Blocks IDE for windows
« Reply #2 on: October 16, 2022, 11:02:33 am »
When the linker complains about missing functions google function's name. For example. if the missing function is called CreateWindowEx, you will find links to pages about it (or it ended in A or W). In this case, use https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-createwindowexa. At the end of the page you have a Requirements section, and it says the function is in the user32.lib library.

Add this library (or user32.a if you are using MinGW) to Projects -> Build options -> Linker settings -> Link libraries.