Monday, November 1, 2010

Problems solved while Making CPP app work on eclipse CDT with cygwin

On Windows.
Using libsndfile to decode wav file to raw pcm.

Problem1: Linking to the external library  libsndfile.
Extracting/installing libsndfile gave me the header and DLL.

In Eclipse, Set [Project->Properties->C/C++ General->"Paths and Symbols"->include] and  [Libraries] to the .h and .dll files respectively.(F:\libsnd\includes\libsndfile-1.h and F:\libsnd\libsndfile-1.dll)
Result: While linking "File not found: libsndfile-1.h"

Solution:
Added folder containing libsndfile-1.dll (F:\libsnd\) to [Project->Properties->C/C++ General->"Paths and Symbols"->Library Paths] and added "sndfile-1" to [Libraries] {"libsndfile-1.dll" - ["lib", ".dll"]}

Solved.

Problem2: Now EXE is generated but on "Run" throws "multiple target patterns. Stop." in some ".d" file

http://dev.eclipse.org/newslists/news.eclipse.tools.cdt/msg12202.html : The ":" in path to header file is detected as a new target.

Solution: 
Changed "F:\libsnd\includes\libsndfile-1.h" to "/cygdrive/f/libsnd/includes/libsndfile-1.h" in [Project->Properties->C/C++ General->"Paths and Symbols"->include]

Solved.

Problem3: While debugging it says "gdb unknown target exception"


Add path to DLL file in environment variable "PATH". Restart eclipse.
Or Copy the dll to the project folder

Tried editing the path variable.

Solved.