Author Topic: Getting C++ to compile (vector no such file) "make" works but not CB  (Read 8014 times)

Offline foldingBLACKlinesSUCK

  • Multiple posting newcomer
  • *
  • Posts: 29
Hello,

I have Cygwin installed. I have set it up properly.


I am getting:

Code
C:/Cygwin/home/Computer/asdf/kool.c:11:18: vector: No such file or directory
C:/Cygwin/home/Computer/asdf/kool.c:13: error: parse error before "namespace"

Any help?
« Last Edit: March 08, 2009, 06:59:24 am by foldingBLACKlinesSUCK »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
The compiler can't find the header file  "vector", so it seems your Cygwin was not installed correctly.
I haven't used Cygwin, I use MinGW instead, and it works quite well. :D
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline foldingBLACKlinesSUCK

  • Multiple posting newcomer
  • *
  • Posts: 29
Getting C++ to compile (vector no such file) "make" works but not CB :(
« Reply #2 on: March 08, 2009, 06:57:49 am »
The compiler can't find the header file  "vector", so it seems your Cygwin was not installed correctly.
I haven't used Cygwin, I use MinGW instead, and it works quite well. :D

Fixed;I had to choose "this project uses a custom MAKEFILE".

But I have one problem; it seems to be rebuilding all files and not checking for changes in file and compiling only the changed files.... (even w/ Build)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Getting C++ to compile (vector no such file) "make" works but not CB
« Reply #3 on: March 08, 2009, 07:10:11 am »
I have built the OpenCV library(it is a big library, and use makefiles) under Mingw, If I change some source, only the source file modified will be compiled. So, it works OK in my system.

Maybe, the problem comes from your "Cygwin" or "Makefile script". But I'm not sure :(
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Getting C++ to compile (vector no such file) "make" works but not CB
« Reply #4 on: March 08, 2009, 07:52:22 am »
Hello,

I have Cygwin installed. I have set it up properly.


I am getting:

Code
C:/Cygwin/home/Computer/asdf/kool.c:11:18: vector: No such file or directory
C:/Cygwin/home/Computer/asdf/kool.c:13: error: parse error before "namespace"

Any help?

"vector" is an C++ header. Code::Blocks defaults to treating .c files as "c" files NOT "c++" files.
Tim S
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org