tags:

views:

1149

answers:

4

Hi experts,

Here is a little problem that cannot be resolved by me such a Linux program newbie.

Now I have a main.cpp program which need to be compiled, there is a

#include "Down.h"

in the front of file.

Actually, this header file exist in the other directory, which locates at ../../../include directory. Besides, some other header files needed by Down.h also locate at this ../../../include directory.

Here is the problem, I compile main.cpp with command

g++ -I /../../../include main.cpp

However, it gives lots of error info which means it is not correct to be done like this.

Or should I also change the include declaration into this one?

#include "../../../include/DownConvert.h"

So, can you leave me some advices? Thanks.

after using g++ -I../../../include main.cpp, I get the following errors, maybe you can take a look at them, thanks.

jl@jl-linux:~/videocoding/jsvm2/JSVM/H264Extension/src/tools/PSNR$ g++ -I ../../../include main.cpp In file included from ../../../include/DownConvert.h:98, from main.cpp:92: ../../../include/ResizeParameters.h:4:22: error: TypeDefs.h: No such file or directory In file included from /usr/include/c++/4.4/bits/stl_algo.h:61, from /usr/include/c++/4.4/algorithm:62, from ../../../include/H2 
A: 

g++ -I ../../../include main.cpp

ought to work

Chris Card
A: 

Try to use -v option:

g++ -v -I ../../../include main.cpp

And check that list of directories to search for include files contains your folder and there is no complains that this folder is absent. If there is this sort of complains correct the path that you give after -I

skwllsp
A: 
g++ -I /../../../include main.cpp

See that leading slash after the -I, that's an absolute path. Change it to a relative path (shown below) it'll work ok

g++ -I ../../../include main.cpp
Glen
A: 

Here is more info about my question which could be look easily written here.

after using the command of

g++ -I../../../include main.cpp

I still get the following errors info, maybe you can take a look at them for the reference, many thanks.

jl@jl-linux:~/videocoding/jsvm2/JSVM/H264Extension/src/tools/PSNR$ g++ -I ../../../include main.cppIn file included from ../../../include/DownConvert.h:98,
                 from main.cpp:92:
../../../include/ResizeParameters.h:4:22: error: TypeDefs.h: No such file or directory
In file included from /usr/include/c++/4.4/bits/stl_algo.h:61,
                 from /usr/include/c++/4.4/algorithm:62,
                 from ../../../include/H264AVCCommonIf.h:139,
                 from ../../../include/ResizeParameters.h:5,
                 from ../../../include/DownConvert.h:98,
                 from main.cpp:92:
/usr/include/c++/4.4/bits/algorithmfwd.h:353:41: error: macro "max" passed 3 arguments, but takes just 2
/usr/include/c++/4.4/bits/algorithmfwd.h:364:41: error: macro "min" passed 3 arguments, but takes just 2
In file included from /usr/include/c++/4.4/bits/stl_algo.h:61,
                 from /usr/include/c++/4.4/algorithm:62,
                 from ../../../include/H264AVCCommonIf.h:139,
                 from ../../../include/ResizeParameters.h:5,
                 from ../../../include/DownConvert.h:98,
                 from main.cpp:92:
/usr/include/c++/4.4/bits/algorithmfwd.h:349: error: expected unqualified-id before ‘const’
/usr/include/c++/4.4/bits/algorithmfwd.h:349: error: expected ‘)’ before ‘const’
/usr/include/c++/4.4/bits/algorithmfwd.h:349: error: expected ‘)’ before ‘const’
/usr/include/c++/4.4/bits/algorithmfwd.h:349: error: expected initializer before ‘const’
/usr/include/c++/4.4/bits/algorithmfwd.h:353: error: template declaration of ‘const _Tp& std::max’
/usr/include/c++/4.4/bits/algorithmfwd.h:360: error: expected unqualified-id before ‘const’
/usr/include/c++/4.4/bits/algorithmfwd.h:360: error: expected ‘)’ before ‘const’
/usr/include/c++/4.4/bits/algorithmfwd.h:360: error: expected ‘)’ before ‘const’
/usr/include/c++/4.4/bits/algorithmfwd.h:360: error: expected initializer before ‘const’
/usr/include/c++/4.4/bits/algorithmfwd.h:364: error: template declaration of ‘const _Tp& std::min’
In file included from /usr/include/c++/4.4/algorithm:62,
                 from ../../../include/H264AVCCommonIf.h:139,
                 from ../../../include/ResizeParameters.h:5,
                 from ../../../include/DownConvert.h:98,
                 from main.cpp:92:
/usr/include/c++/4.4/bits/stl_algo.h: In function ‘void std::__merge_sort_loop(_RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, _Distance)’:
/usr/include/c++/4.4/bits/stl_algo.h:3239: error: expected unqualified-id before ‘(’ token
/usr/include/c++/4.4/bits/stl_algo.h: In function ‘void std::__merge_sort_loop(_RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, _Distance, _Compare)’:
/usr/include/c++/4.4/bits/stl_algo.h:3263: error: expected unqualified-id before ‘(’ token
In file included from ../../../include/ResizeParameters.h:5,
                 from ../../../include/DownConvert.h:98,
                 from main.cpp:92:
../../../include/H264AVCCommonIf.h: At global scope:
../../../include/H264AVCCommonIf.h:180: error: ‘UInt64’ has not been declared
../../../include/H264AVCCommonIf.h:187: error: ISO C++ forbids declaration of ‘UInt64’ with no type
../../../include/H264AVCCommonIf.h:187: error: expected ‘;’ before ‘&’ token
../../../include/H264AVCCommonIf.h:189: error: expected ‘;’ before ‘Void’
../../../include/H264AVCCommonIf.h:189: error: ‘UInt64’ has not been declared
../../../include/H264AVCCommonIf.h:195: error: ‘UInt64’ does not name a type
../../../include/H264AVCCommonIf.h: In constructor ‘PicBuffer::PicBuffer(Pel*, Void*, int)’:
../../../include/H264AVCCommonIf.h:180: error: class ‘PicBuffer’ does not have any field named ‘m_ui64Cts’
../../../include/H264AVCCommonIf.h: In member function ‘Void PicBuffer::setCts(int)’:
../../../include/H264AVCCommonIf.h:189: error: ‘m_ui64Cts’ was not declared in this scope
In file included from ../../../include/DownConvert.h:98,
                 from main.cpp:92:
../../../include/ResizeParameters.h: At global scope:
../../../include/ResizeParameters.h:53: error: expected ‘,’ or ‘...’ before ‘||’ token
main.cpp: In function ‘int main(int, char**)’:
main.cpp:287: warning: NULL used in arithmetic
main.cpp:345: warning: deprecated conversion from string constant to ‘char*’
main.cpp:346: warning: deprecated conversion from string constant to ‘char*’
main.cpp:347: warning: deprecated conversion from string constant to ‘char*’
main.cpp:348: warning: deprecated conversion from string constant to ‘char*’
main.cpp:349: warning: deprecated conversion from string constant to ‘char*’
main.cpp:350: warning: deprecated conversion from string constant to ‘char*’
MaiTiano
post all code, and people will point the errors out one by one.
EffoStaff Effo