Author Topic: still trying to figure out where to put a (i think its called) a linking directi  (Read 3820 times)

Offline userx-bw

  • Multiple posting newcomer
  • *
  • Posts: 14
I am using X11 and it seems from my searches on this subject to add the ole -lX11 to the command for compiler directives so codeblocks knows to compile with -lX11 so I will stop getting the "undefined reference XOpenDisplay" error when the rest of code blocks shows me ever header file for X11  as well as the function calls for X11 whenever I start to write one, including XOpenDisplay then tells gives me that error of "undefined reference XOpenDisplay" which is clearly a bug within CodeBlocks IDE interphase.

I placed this directive in the settings->compiler->other compiler settings as well as the other tab for other resource compiler options and it still has not stopped this behavior.

I cannot see why codeblocks knows to show me the header files when typing in #include X11 then a list popes up to pick from which X11 headers to use then when coding type XOp and a list pops up to pick which function call to use then when trying to compile something that codeblocks clearly knows that it gave me the header files to use and the function calls that go long with it, instead of actually compiling it gives me an error instead.

what kind of illogical mistake is that, and where do I have to add this directive -lX11 to get this Code::Blocks to stop being stupid?

« Last Edit: August 14, 2017, 06:11:55 pm by userx-bw »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
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 userx-bw

  • Multiple posting newcomer
  • *
  • Posts: 14
http://wiki.codeblocks.org/index.php/FAQ-Compiling_(general)#Q:_I_would_like_to_compile_a_project_using_some_non-standard_libraries._How_can_I_indicate_to_CodeBlocks_that_these_libraries_and_include_files_exist.3F

Follow the directions in the "For your project :" section.

Tim S.

I'll go dig in to that in a min, but first this comment ,

it does not excuse CODE:BLOCKS from knowing the header files and their function calls by showing me them before even telling it I will be using them in the special setting area to give it the path to the headers that it is showing me It already knows I have.

Then still having to add the path to where they are at when it already knows everything else about the X11 headers and their function calls. Just not that.

bad logical programming or laziness on the one that created this IDE?

Offline userx-bw

  • Multiple posting newcomer
  • *
  • Posts: 14
http://wiki.codeblocks.org/index.php/FAQ-Compiling_(general)#Q:_I_would_like_to_compile_a_project_using_some_non-standard_libraries._How_can_I_indicate_to_CodeBlocks_that_these_libraries_and_include_files_exist.3F

Follow the directions in the "For your project :" section.

Tim S.

X11: /usr/bin/X11 /usr/lib64/X11 /etc/X11 /usr/include/X11 /usr/share/X11

search directories -> compiler -> add

added that path still get errors. how long as code blocks been around and how long will it take them to stop making this mistake of telling the user it knows every sticking header X11 has and all of the functions for X11 but has no idea where the header files are located especially on a Linux box?

just push it off on the user to figure out how to finish the their job

bad programming, and I am less then  an average programmer and can see that.
« Last Edit: August 14, 2017, 06:31:30 pm by userx-bw »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Please read the rules before you are banned!
http://forums.codeblocks.org/index.php/topic,9996.0.html

Hint: -llibraryname the -l implies it is a library name!!!

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

Offline sodev

  • Regular
  • ***
  • Posts: 497
and I am less then  an average programmer
I totally agree on that! And because of that it seems you are missing some basic information about what is going on here.

CodeBlocks is not a compiler, its basically a frontend for a compiler. The compiler you are using is gcc and the error you are seeing is from gcc, not CodeBlocks.

Why does code completion of CodeBlocks know about all these X11 headers? Because you told CodeBlocks where to look for them and, big surprise, you told CodeBlocks the correct location?

But why isnt gcc happy with your headers? Well, the compiling stage is, but the linking stage isnt. Because the linker gives a fuck about your headers, all it cares about is libraries.

So you only told CodeBlocks where the headers are which CodeBlocks told gcc, but you didnt tell CodeBlocks where the libraries are so gcc complains about.

So no bad programming here, only bad user here, this cannot be fixed from this side. And before you cry more, it is and has always been the responsibility of the user to setup his compiler environment.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
bad programming, and I am less then  an average programmer and can see that.
With that attitude, you will never become even a beginner in programming.
It's often not easy to understand even simple programs, written by others, fully.
But Code::Blocks is by far not a simple program, with it's core and plugins.