Author Topic: CB ignores search directories/Global variables  (Read 24289 times)

Offline eb

  • Multiple posting newcomer
  • *
  • Posts: 46
CB ignores search directories/Global variables
« on: January 20, 2012, 03:02:34 am »
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

Online stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: CB ignores search directories/Global variables
« Reply #1 on: January 20, 2012, 03:12:11 am »
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.
« Last Edit: January 20, 2012, 01:56:35 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 eb

  • Multiple posting newcomer
  • *
  • Posts: 46
Re: CB ignores search directories/Global variables
« Reply #2 on: January 20, 2012, 07:45:28 pm »
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.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255

Online stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: CB ignores search directories/Global variables
« Reply #4 on: January 20, 2012, 08:17:46 pm »
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++ 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 eb

  • Multiple posting newcomer
  • *
  • Posts: 46
Re: CB ignores search directories/Global variables
« Reply #5 on: January 20, 2012, 08:52:04 pm »
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.

Offline eb

  • Multiple posting newcomer
  • *
  • Posts: 46
Re: CB ignores search directories/Global variables
« Reply #6 on: January 20, 2012, 08:58:32 pm »
"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.

Offline eb

  • Multiple posting newcomer
  • *
  • Posts: 46
Re: CB ignores search directories/Global variables
« Reply #7 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'.

Online stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: CB ignores search directories/Global variables
« Reply #8 on: January 20, 2012, 09:45:26 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.
« Last Edit: January 20, 2012, 09:47:49 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 eb

  • Multiple posting newcomer
  • *
  • Posts: 46
Re: CB ignores search directories/Global variables
« Reply #9 on: January 20, 2012, 10:01:17 pm »
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.

Online stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: CB ignores search directories/Global variables
« Reply #10 on: January 20, 2012, 10:08:30 pm »
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.
« Last Edit: January 20, 2012, 10:14:56 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 eb

  • Multiple posting newcomer
  • *
  • Posts: 46
Re: CB ignores search directories/Global variables
« Reply #11 on: January 20, 2012, 10:27:10 pm »
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 .

Offline eb

  • Multiple posting newcomer
  • *
  • Posts: 46
Re: CB ignores search directories/Global variables
« Reply #12 on: January 20, 2012, 10:40:21 pm »
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
 

Offline eb

  • Multiple posting newcomer
  • *
  • Posts: 46
Re: CB ignores search directories/Global variables
« Reply #13 on: January 20, 2012, 10:50:52 pm »
OK you win.  I'm switching back to non-cygwin headers/libs BUT this codeBlocks problem is still a problem!

Online stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: CB ignores search directories/Global variables
« Reply #14 on: January 20, 2012, 10:51:35 pm »
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++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org