News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

CB ignores search directories/Global variables

Started by eb, January 20, 2012, 03:02:34 AM

Previous topic - Next topic

eb

Googled it and scoured this site for a couple of days.  Now I'm asking.

Why is it that when I "#include rpc.h" the compiler always throws me a "error: rpc.h: No such file or directory"?

My search directories (compiler) are:
  ..\..\..\usr\x86_64-w64-mingw32\sys-root\mingw\include
  C:\cygwin\usr\x86_64-w64-mingw32
  C:\cygwin\usr\x86_64-w64-mingw32\sys-root\mingw\include

My BuiltIn fields are:
  base: C:\cygwin\usr\x86_64-w64-mingw32\sys-root\mingw
  Include: C:\cygwin\usr\x86_64-w64-mingw32\sys-root\mingw\include

My Selected compiler is Cygwin GCC

My rpc.h file is: C:\cygwin\usr\x86_64-w64-mingw32\sys-root\mingw\include\rpc.h

stahta01

#1
Did you try turning on full compiler logging and reading the build logs?

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

Edit: You do know that you are still likely mixing Cygwin and MinGW headers and this is likely NOT to work.

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

eb

All the Build Log shows is this:

-------------- Clean: Release in rap00 ---------------

Cleaned "rap00 - Release"

-------------- Build: Release in rap00 ---------------

Compiling: main.c
In file included from C:\cygwin\home\eb\rap00\main.c:10:
C:\cygwin\home\eb\rap00\rap.h:10:17: error: rpc.h: No such file or directory
In file included from C:\cygwin\home\eb\rap00\main.c:10:
C:\cygwin\home\eb\rap00\rap.h:310: error: expected ')' before '*' token
C:\cygwin\home\eb\rap00\main.c: In function 'rapvar_read_name_1':
C:\cygwin\home\eb\rap00\main.c:40: warning: function returns address of local variable
C:\cygwin\home\eb\rap00\main.c: In function 'main':
C:\cygwin\home\eb\rap00\main.c:47: warning: unused variable 'Pclient'
Process terminated with status 1 (0 minutes, 0 seconds)
2 errors, 2 warnings

I was under the assumption that I set something wrong and need to be pointed to the proper setting.

Also, I'm trying to use only the mingw headers/libs that came via the cygwin installer. 
I'm hoping they already have a facility for this problem.


stahta01

I suggest you also read my response in the cboard forum; which I am guessing was started by you.

http://cboard.cprogramming.com/c-programming/145288-undefined-reference-clnt_create.html

Feel free to keep the Code::Blocks questions in this thread; but, I think the root cause of your problem is a Compiler question that is not correct to post this forum.

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

eb

Thanks Tim.  Didn't see that last post over there until now.

And in my defense my original question over here is (basically):
  What is the proper CodeBlocks setting so that when I #include <rpc.h> the compiler looks for C:\cygwin\usr\x86_64-w64-mingw32\sys-root\mingw\include\rpc.h?

A a related problem/question is:
  If you look at my settings (see previos reply) why is it that #include "tirpc/rpc/clnt.h" leads me to C:\cygwin\usr\include\tirpc\rpc\clnt.h when I do not have "C:\cygwin\usr\include" entered as any of my settings.  I did before but as you see I have removed them AND restarted CodeBlocks.

Again I apologize for the elementary question but the online manual has me befuddled.

eb

"And another thing!..."

This may help someone figure out what i'm doing wrong:
  If I add "C:\cygwin\usr\x86_64-w64-mingw32\sys-root\mingw\include\rpc.h" to the project, I can right click-> Open #include file: 'rpc.h' and it with open the proper file but the compiler still can't find it.

eb

fyi - I have Compiler logging: set to Full command line.
My other 2 choices are 'Task description' and 'No logging'.

stahta01

#8
Quote from: eb on January 20, 2012, 09:37:37 PM
fyi - I have Compiler logging: set to Full command line.
My other 2 choices are 'Task description' and 'No logging'.


That can be true; but, if you do NOT post the full build log after a full rebuild; then it really does NOT help us help you.

Edit: You do realize that you are likely wasting your time. Getting MinGW64 headers to work with the Cygwin compiler is NOT easy and may be impossible!!

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

eb

That may be so but my immediate problem is getting Code Blocks to work properly.
For instance I have just changed my Compiler logging setting from 'Full command line' to 'No logging', I executed a 'Rebuild workspace' and the build log says the same EXACT thing it said  before.
  It seems to me that CodeBlocks is saving my settings as I can see them from session to session, but it's not using them.

  And I am happy to lay off of the non-CodeBlocks issue BUT it does not make sense to me that Cygwin would supply Mingw libs that you could not use with Cygwin.

stahta01

#10
NOTE: The Compiler you are changing the options on; MUST be the Compiler you are using to compile your project!

To check the CB Compiler name being used to compile your project do this.
"Project" -> "Build Options"
Check the selected compiler for each of the Target in the left hand pane.

To change Compiler Options:
"Settings" -> "Compiler and Debugger"
Pick the correct Compiler in the "Selected Compiler" pull down.
NOTE: Making this the default compiler is recommended!


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

eb

Well under my Global compiler settings my Selected compiler says Cygwin GCC.
Auto-detect set the Compiler's installation directory to C:\Cygwin.
Global compiler settings->Toolchain executables->[tab]Program files->C compiler is C:\cygwin\bin\x86_64-w64-mingw32-gcc.exe .

eb

So i tried starting from scratch.
I started a new project with a new name.
Main.c and rap.h are both in the C:\cygwin\home\eb\rap02 directory.
I have also entered 'C:\cygwin\home\eb\rap02' into Search directories->[tab]Compiler (under Global compiler settings).
The Selected compiler is still Cygwin GCC.

So now main.c contains '#include rap.h' and with Compiler logging set to Full command line my Build log says:



-------------- Build: Debug in rap02 ---------------

x86_64-w64-mingw32-gcc.exe -Wall  -g    -IC:/cygwin/home/eb/rap02  -c C:/cygwin/home/eb/rap02/main.c -o obj/Debug/main.o
cygwin warning:
  MS-DOS style path detected: C:/cygwin/home/eb/rap02/main.c
  Preferred POSIX equivalent is: /cygdrive/c/cygwin/home/eb/rap02/main.c
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
C:/cygwin/home/eb/rap02/main.c:10:17: fatal error: rap.h: No such file or directory
compilation terminated.
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings


eb

OK you win.  I'm switching back to non-cygwin headers/libs BUT this codeBlocks problem is still a problem!

stahta01

Under Compiler Settings "Other Settings"
Check-mark "Explicitly add project top-level directly to compiler search dirs"
Note: The one above this might be more correct. I sometimes check mark them both.

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