User forums > Using Code::Blocks
Add existing file to a project
erotavlas:
--- Quote from: xunxun1982 on November 17, 2010, 05:11:45 pm ---
--- Quote from: erotavlas on November 17, 2010, 05:03:28 pm ---Hi,
I have found the source of my problem. My description in the previous post was not completely correct...I'm sorry. If my project is like this:
--- Code: ---main.cpp
file1.h
file1.cc
data/file2.h
file3.h
--- End code ---
All works fine, but If my project is like this
--- Code: ---main.cpp
file1.h
file1.cc
data/file2.h
data1/file4.h
file3.h
--- End code ---
with #include "file4.h" inside the file file2.h, I get all the previous errors: no such file file4.h. So I can deduce that Code::block doesn't support multiple folders! Is it correct?Is there a workaround?
--- End quote ---
If you use #include "file4.h", you should add the "." and the "./data1" to the include path.
--- End quote ---
Yes, I have also tried it. The result is the same.
xunxun:
If you add include path, I have no idea.
I think you may try to change #include "file4.h" to #include "../data1/file4.h".
Jenna:
--- Quote from: erotavlas on November 17, 2010, 05:03:28 pm ---So I can deduce that Code::block doesn't support multiple folders! Is it correct?
--- End quote ---
No, it's not correct.
C::B is an IDE not a compiler, and it's up to you to know how to set up your project correctly.
erotavlas:
Thank you for your answer. I have not said that I'm under windows 7 with cygwin bash shell and g++/gcc 4.3.4 version1 compiler. I'm still trying to solve the problem, other suggestions are well accepted. Thank in advanced.
xunxun:
--- Quote from: erotavlas on November 18, 2010, 10:29:20 am ---Thank you for your answer. I have not said that I'm under windows 7 with cygwin bash shell and g++/gcc 4.3.4 version1 compiler. I'm still trying to solve the problem, other suggestions are well accepted. Thank in advanced.
--- End quote ---
I think cygwin gcc only recognize the path like "/cygdrive/", so if you use windows path, the gcc compiler may work wrongly.
Could you try to use mingw gcc?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version