topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 6:11 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Problems with GNU C++  (Read 7492 times)

SkyIDE

  • Honorary Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 245
    • View Profile
    • Read more about this member.
    • Donate to Member
Problems with GNU C++
« on: February 06, 2007, 05:01 AM »
Problems with search paths

When you type this:

c++ --help

you get this:

-B <directory>           Add <directory> to the compiler's search paths

I have created two folders in the root directory of my drive. C:\Test and C:\Test2. Both folders contain the file "header.h".

I use the following command:

c++ C:\test.cpp -B "C:\Test;C\Test2" but I get
C:\test.cpp:3:20: header.h: No such file or directory

Regardless what I do, I get the same error message.

c++ C:\test.cpp -B"C:\Test;C\Test2" but I get
C:\test.cpp:3:20: header.h: No such file or directory

c++ C:\test.cpp -B C:\Test;C\Test2 but I get
C:\test.cpp:3:20: header.h: No such file or directory

c++ C:\test.cpp -I "C:\Test;C\Test2" but I get
C:\test.cpp:3:20: header.h: No such file or directory

c++ C:\test.cpp -I"C:\Test;C\Test2" but I get
C:\test.cpp:3:20: header.h: No such file or directory

Well, other compilers have no problems with this. The only one with the problem is GNU C++.

Could be something wrong with my environment settings but that won't make a lot of sense? I am already telling the compiler where are the include files.
« Last Edit: February 06, 2007, 05:26 AM by SkyIDE »

pob

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 15
    • View Profile
    • Donate to Member
Re: Problems with GNU C++
« Reply #1 on: February 06, 2007, 05:56 AM »
Can you definitely give it more than one directory in a list like that?

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Problems with GNU C++
« Reply #2 on: February 06, 2007, 05:59 AM »
Try moving all switches before the filename to compile. If that still doesn't work, you might have to rely on INCLUDE and LIB environment variables.
- carpe noctem

SkyIDE

  • Honorary Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 245
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Problems with GNU C++
« Reply #3 on: February 06, 2007, 06:08 AM »
no luck

I tried with single dir:

c++ C:\test.cpp -B C:\Test

Same story.

Contents of C:\Test.cpp

#include <iostream.h>
#include <header.h>




int main()
{

int iVar = 0;
cout << "Simple C++ Program\n" << endl;



return 0;

}


Then I tried moving the switch before the filename



c++ -B"C:\Test" C:\test.cpp
In file included from ../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/bac
kward/iostream.h:31,
                 from C:\test.cpp:2:
../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/backward/backward_warning
.h:32:2: warning: #warning This file includes at least one deprecated or antiqua
ted header. Please consider using one of the 32 headers found in section 17.4.1.
2 of the C++ standard. Examples include substituting the <X> header for the <X.h
> header for C++ includes, or <iostream> instead of the deprecated header <iostr
eam.h>. To disable this warning use -Wno-deprecated.
C:\test.cpp:3:20: header.h: No such file or directory

same story with

c++ -B "C:\Test" C:\test.cpp


This is one of the only things preventing me to release Beta 11. I must fix this before I release Beta 11.
« Last Edit: February 06, 2007, 06:11 AM by SkyIDE »

SkyIDE

  • Honorary Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 245
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Problems with GNU C++
« Reply #4 on: February 06, 2007, 06:12 AM »
This is weird! I am so sure this problem did not exist!! This must be a different version of GNU C++! I will download an older version and see how I go!

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Problems with GNU C++
« Reply #5 on: February 06, 2007, 06:15 AM »
You shouldn't use "iostream.h", you should use "iostream" and the proper std:: namespace identifiers.
EDIT:
"like this"
Code: C++ [Select]
  1. #include <iostream>
  2. //#include <header.h>
  3.  
  4. using namespace std;
  5.  
  6.  
  7. int main()
  8. {
  9.        
  10.         int iVar = 0;
  11.         cout << "Simple C++ Program\n" << endl;
  12.        
  13.  
  14.        
  15.         return 0;
  16.  
  17. }

- carpe noctem
« Last Edit: February 06, 2007, 06:16 AM by f0dder »

pob

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 15
    • View Profile
    • Donate to Member
Re: Problems with GNU C++
« Reply #6 on: February 06, 2007, 06:16 AM »
Maybe that will only work if the include is:

#include "blahblah.h"

rather than with the <> - as that tends to mean it is in the default place.

SkyIDE

  • Honorary Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 245
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Problems with GNU C++
« Reply #7 on: February 06, 2007, 06:20 AM »
Ahh yes, I tried #include "header.h" it didn't work. Sorry I didn't mention it. Normally this refers to the current directory.

Yes, I never use <iostream.h> The only reason I used it here is because some compilers do not support it out of the box and only support iostream.h. When I do the testing with SkyIDE, I just want to make sure it compiles...the rest the user can install/setup. With most compilers you can install add-ons to make it work but that's outside SkyIDE's scope. It is up to the user. SkyIDE should support automatically whatever the user installs for *that* compiler.
 
« Last Edit: February 06, 2007, 06:27 AM by SkyIDE »

SkyIDE

  • Honorary Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 245
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Problems with GNU C++
« Reply #8 on: February 06, 2007, 06:37 AM »
I tried with an older version of GNU C++, same story. I don't get it.

SkyIDE

  • Honorary Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 245
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Problems with GNU C++
« Reply #9 on: February 06, 2007, 06:41 AM »
FIXED IT!

c++.exe -IC:\Test "C:\test.cpp"

SkyIDE

  • Honorary Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 245
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Problems with GNU C++
« Reply #10 on: February 06, 2007, 06:42 AM »
Wierd!

This also works now:

c++.exe "C:\test.cpp" -IC:\Test
« Last Edit: February 06, 2007, 06:45 AM by SkyIDE »

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Problems with GNU C++
« Reply #11 on: February 06, 2007, 06:45 AM »
Wierd!

This also works now:

c++.exe "C:\test.cpp" -IC:\Test
Well, if you fixed <iostream.h> to use <iostream> instead, then no wonder you don't get deprecation warnings :)
- carpe noctem

SkyIDE

  • Honorary Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 245
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Problems with GNU C++
« Reply #12 on: February 06, 2007, 07:10 AM »
the problem was it was unable to find header.h in the search path but may be this is all related. Just for the record, SkyIDE auto generates the new <iostream> whch is the right way.

Thanks for the help guys. I expect a release in 1-2 days.