NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Netbeans: header file path configuration for Linux C++ project

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
h9uest



Joined: 31 Mar 2011
Posts: 4

PostPosted: Thu Mar 31, 2011 12:56 am    Post subject: Netbeans: header file path configuration for Linux C++ project Reply with quote

Hi people:

I used to program in C++ with vim, but now want to make a shift to Netbeans. I typically work with Makefile projects (a tar.gz package containing source code and Makefile). I imported the project into Netbeans but have the following problem:

In the Makefile project: in source file, say, main.cc, I have
Code:
#include "include/header_1.h"
, where "include" is a sub directory in my project root directory and header_1.h is a header file defined by me. In the Makefile, I simply use -I option to let the compiler find the header files. No problem at all. But when I try to build the project with Netbeans, it tells me it "cannot find" the header file. How can I make Netbeans find the header file?

The even more weird thing is, although netbeans tells me this error and highlight all "unresolved identifiers", when I build the app, it works! When I run it, it also works (still highlighting the unresolved identifiers)! What the heck is this?

Thanks in advance
Back to top
h9uest



Joined: 31 Mar 2011
Posts: 4

PostPosted: Thu Mar 31, 2011 12:29 pm    Post subject: Reply with quote

Anyone??

Thanks
Back to top
Vladimir Voskresensky
Posted via mailing list.





PostPosted: Tue Apr 05, 2011 6:53 pm    Post subject: Netbeans: header file path configuration for Linux C++ project Reply with quote

Quote:

Hi people:

I used to program in C++ with vim, but now want to make a shift to Netbeans. I typically work with Makefile projects (a tar.gz package containing source code and Makefile). I imported the project into Netbeans but have the following problem:

In the Makefile project: in source file, say, main.cc, I have
Code:
#include "include/header_1.h"

, where "include" is a sub directory in my project root directory and header_1.h is a header file defined by me. In the Makefile, I simply use -I option to let the compiler find the header files. No problem at all. But when I try to build the project with Netbeans, it tells me it "cannot find" the header file. How can I make Netbeans find the header file?

The even more weird thing is, although netbeans tells me this error and highlight all "unresolved identifiers", when I build the app, it works! When I run it, it also works (still highlighting the unresolved identifiers)! What the heck is this?

Thanks in advance

Hi.

You'd better ask C++ related topics in dedicated C++ forum/mail list
(address-removed).
As to your question:
- in project properties you can always specify Additional include
directives in C++ section

Thanks,
Vladimir.
Back to top
chjan



Joined: 09 Dec 2011
Posts: 4

PostPosted: Sun Apr 29, 2012 10:42 am    Post subject: Netbeans will not take header file paths at all Reply with quote

I am running through a couple of tutorials on C compilation with Netbeans. Whatever I do, I cannot convince Netbeans to grasp even the most simple paths to the files. The only solution that works is to put the header file in the same physical folder as the cpp files. Then everything works well.

So, there seem to be a serious weakness i the C module of Netbeans, given all those questions of similar nature on the net.

Header files are not found by Netbeans!

I just wonder; is this C/C++ module in use at all ? Spending "days" on trying to setup a simple path seems like a cold wind from the days of old.

If anyone has a waterproof remedy, then many thanks beforehand. I am using NB 7+ on Win7, mostly for Java and Android (in which context NB is just perfect!).

cheers
Carl
Back to top
chjan



Joined: 09 Dec 2011
Posts: 4

PostPosted: Sun Apr 29, 2012 10:43 am    Post subject: Netbeans will not take header file paths at all Reply with quote

UPDATE: YES, THE NETBEANS FEATURE: RIGHT CLICK PROPERTIES\BUILD\C COMPILER\INCLUDE DIRECTORIES DOES NOT WORK. PATHS ARE NOT TAKEN INTO ACCOUNT BY COMPILER. HEADER FILES ARE NOT FOUND, REGARDLESS. THIS MODULE NEEDS REVISION!

HOWEVER, FOR ANYONE ELSE WITH THIS PROBLEM, I GOT AROUND IT BY INCLUDING HEADER FILES IN THE FOLLOWING MANNER:

#INCLUDE "SUBFOLDER/SUBSUBFOLDER/MYHEADERFILE.H"

INSTEAD OF JUST WRITING

#INCLUDE "MYHEADERFILE.H"

...............

I am new to this forum, so; How to ensure that bugs are put into someones TODO list ? Also, is there a responsible for this C module that I can speak to about these things ?

...............

MY PREVIOUS TEXT:
I am running through a couple of tutorials on C compilation with Netbeans. Whatever I do, I cannot convince Netbeans to grasp even the most simple paths to the files. The only solution that works is to put the header file in the same physical folder as the cpp files. Then everything works well.

So, there seem to be a serious weakness i the C module of Netbeans, given all those questions of similar nature on the net.

Header files are not found by Netbeans!

I just wonder; is this C/C++ module in use at all ? Spending "days" on trying to setup a simple path seems like a cold wind from the days of old.

If anyone has a waterproof remedy, then many thanks beforehand. I am using NB 7+ on Win7, mostly for Java and Android (in which context NB is just perfect!).

cheers
Carl


Last edited by chjan on Sun Apr 29, 2012 11:03 am; edited 1 time in total
Back to top
chjan



Joined: 09 Dec 2011
Posts: 4

PostPosted: Sun Apr 29, 2012 10:43 am    Post subject: Netbeans will not take header file paths at all Reply with quote

I am running through a couple of tutorials on C compilation with Netbeans. Whatever I do, I cannot convince Netbeans to grasp even the most simple paths to the files. The only solution that works is to put the header file in the same physical folder as the cpp files. Then everything works well.

So, there seem to be a serious weakness i the C module of Netbeans, given all those questions of similar nature on the net.

Header files are not found by Netbeans!

I just wonder; is this C/C++ module in use at all ? Spending "days" on trying to setup a simple path seems like a cold wind from the days of old.

If anyone has a waterproof remedy, then many thanks beforehand. I am using NB 7+ on Win7, mostly for Java and Android (in which context NB is just perfect!).

cheers
Carl
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo