C ++ STL map typedef errors

I have a very nasty problem with the code I wrote. I found someone else that had the same problem on stackoverflow, and I tried the solutions, but no one worked for me.

I am typing a few common types of STL that I use, and none of the others have any problems except when I try to print a map. I get "some_file.h: 83: error: expected initializer to" <"token" when I include my header in the test program.

Here's the important part of the header (some_file.h):

#ifndef SOME_FILE_H
#define SOME_FILE_H
// some syntax-correct enums+class prototypes
typedef std::string str;
typedef std::vector<Column> col_vec;
typedef col_vec::iterator col_vec_i;
typedef std::vector<Row> row_vec;
typedef row_vec::iterator row_vec_i;
typedef std::vector<str> str_vec;
typedef str_vec::iterator str_vec_i;
typedef std::vector<Object> obj_vec;
typedef obj_vec::iterator obj_vec_i;
typedef std::map<Column, Object> col_obj_map; // error occurs on this line
typedef std::pair<Column, Object> col_obj_pair;

Some_file.cpp includes:

#include <utility>
#include <map>
#include <vector>
#include <iostream>
#include <string>
#include <stdio.h>
#include <cc++/file.h>
#include "some_file.h"

The test file just includes the line, vector, and my file in that order. It has a basic method that just looks like the world.

, , , ( "std::map<Column..." "hello<Column..." ), .

, , <.

+3
4

, , . , . STL: , , . , . , barfs , , , some_file.h, , . , , ( STL ).

, , . some_file.h , , :

#include <string>
#include <map>
#include <utility> // header for pair
#include <vector>

, #ifdef... #endif, , , . , , . STL " # " # 48.

+14

#include <map> - ?

, , . .

+5

. typedef.

.

#include <map>
#include <string>
#include <map>

- , some_file.h(, ), , , include #include "some_file.h" . , .

+5

, . , , , , :

  • std- , map. , .
  • # .

- - , C, . , - . , #include.

- , - cmd- .

0

Source: https://habr.com/ru/post/1714278/


All Articles