开发者

Compiling C++ with cygwin doesn't search provided include paths

开发者 https://www.devze.com 2023-04-06 08:02 出处:网络
I am working within a tree that compiles fine on any Unix machine I throw it at, but Cygwin is being difficult and I\'m not really sure where to start. I have the following directory structure:

I am working within a tree that compiles fine on any Unix machine I throw it at, but Cygwin is being difficult and I'm not really sure where to start. I have the following directory structure:

buildwin/
|-- main.cpp
|-- other project files
|-- include/
    |-- tclap
        |-- CmdLine.h
        |-- other files (including CmdLine.cpp)
    |-- eigen
        |-- (appropriate files)
    |-- rapidxml
        |-- (appropriate files)

When I try to compile this, I get the following error from g++:

$ g++ main.cpp -lglut32 -lglu32 -lopengl32开发者_如何学Python -Iinclude/eigen -Iinclude/rapidxml -Iinclude/tclap
main.cpp:6:27: fatal error: tclap/CmdLine.h: No such file or directory
compilation terminated.

I know it's finding the other libraries (eigen and rapidxml) fine because if I remove the respective include flags, it throws an error saying that it can't find eigen or what have you.

The include statement in question is:

// snip
#include <Eigen/StdVector>
#include <cmath>
#include <iostream>
#include <fstream>

#include <tclap/CmdLine.h>
// snip

Ideas? Thanks!


You're specifying -Iinclude/tclap, then include tclap/CmdLine.h, so the compiler goes hunting for include/tclap/tclap/CmdLine.h.

Either use -Iinclude, or include CmdLine.h without the path.


Does using -Iinclude work? You probably don't need to be explicitly adding the subdirs of include because you refer to them in the names in the #include statements.

0

精彩评论

暂无评论...
验证码 换一张
取 消