Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7602927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:32:15+00:00 2026-05-30T23:32:15+00:00

I am trying to build a library in a legacy C++ project. Platform is

  • 0

I am trying to build a library in a legacy C++ project. Platform is power-pc using gcc compiler.

The compiler is giving build errors similar to this: error: string: No such file or directory or error: vector: No such file or directory.

  • My understanding is that it is not able to locate the standard library. Where are the standard library files typically reside, and in what format? Is it *.h or some other? I searched for this on internet but I don’t think I fully understand it.

  • The confusing part is that another library in the same project using same source code file builds prefectly alright. This suggests to me that may be the makefiles for these two projects are different, where one IS able to locate the std lib, other isn’t. But a quick comparison b/w the two didn’t bring up any obvious differences. Any other thoughts on this please?

  • Lastly, I just learned that string.h is for c-style strings, and string is for C++ std lib. Is it ok to mix them, i.e. a source file has #include string.h, and also #include string implicitly through including some other file? I ask because this is the same situation in the file that is not building.

Thanks.

Error Message:

Compiling SOURCE_FILE.cpp

In file included from SOURCE_FILE.cpp:3:

HDR_FILE.h:1: error: string: No such file or directory

HDR_FILE.h:2: error: vector: No such file or directory

CODE IN SOURCE_FILE.cpp

#include <stdlib.h>
#include <string.h>
#include "fileABC.h"

using namespace std;

// Other code

CODE IN HRD_FILE.h

#include <string>
#include <vector>
#include <hdr.h>
#include <hdr-cseq.h>
//... OTHER FILES ETC.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T23:32:17+00:00Added an answer on May 30, 2026 at 11:32 pm

    If the files are not being detected as C++ source code then you can get errors like this. Are the c++ files named using an appropriate file extension?

    cat test.c

    #include <vector>
    int main() {}
    

    gcc test.c

    test.c:1:18: error: vector: No such file or directory
    

    The command above will compile C code, but not C++. Remember that these are two different languages. To build C++ programs you have to tell the compiler that the source is C++ one way or another. If you use g++ it will automatically assume files with ‘.c’ extensions are C++ (at least my version does. Or you can tell the compiler to use C++ by passing -x c++ right before you pass the file. You also have to tell the linker to include the C++ library. g++ does this automatically as well, or you can pass the linker flag -lstdc++.

    The hard way:

    gcc -x c++ test.c -lstdc++

    The easy way:

    g++ test.c

    In answer to your last question, you can freely mix <string.h> and <string> (though you should probably use <cstring> instead of <string.h>).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to build up a library of reusable code to use from project
I'm trying to build a wrapper library with VC++'s compiler. ErlDriver.c #define __WIN32__ #define
I'm trying to build a C/C++ static library using visual studio 2005. Since the
I'm trying to build an Android project using the ndk, but I have run
I'm trying to build a static library but i get compile-time errors such as:
I'm trying to build the sample project Action Bar Styled using the Action Bar
This is my first time using CMake and I'm trying to build QJSon, a
I'll make this as short as possible. I'm trying to build a static library
I'm trying to build a version of Botan (library for cryptographic algorithms) using JNI
So I'm trying to build this library that is a .NET binding for Mapnik

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.