GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 27-Mar-2009, 02:39
keko keko is offline
New Member
 
Join Date: Mar 2009
Posts: 2
keko is on a distinguished road

Error: expected primary-expression before '.' token


hello everyone,

I'm working with boost graph library, i get this compilation error and i don't know how to fix it, could anyone help me?:

error: expected primary-expression before '.' token

Here is my code :

CPP / C++ / C Code:
struct gate_level_t {
  		typedef vertex_property_tag kind;
	};

typedef property<gate_level_t, int> g_level;

struct edge_properties {
  std::string name;

  template<class Archive>
  void serialize(Archive & ar, const unsigned int version) {
      ar & name;
  }
};


typedef adjacency_list<vecS, vecS, undirectedS,g_level , edge_properties> Graph;


Graph g;


property_map<Graph, gate_level_t>::type
	noeud_level=get(g_level,g);

The error is in the last line.
I've omitted all irrelevant code.

Thanx!
Last edited by admin : 27-Mar-2009 at 03:20. Reason: Please insert your example C/C++ codes between [CPP] and [/CPP] tags
  #2  
Old 27-Mar-2009, 04:28
L7Sqr L7Sqr is offline
Member
 
Join Date: Jul 2005
Location: constant limbo
Posts: 234
L7Sqr is a jewel in the roughL7Sqr is a jewel in the rough

Re: Error: expected primary-expression before '.' token


Quote:
Originally Posted by keko
The error is in the last line.
I've omitted all irrelevant code.
Obviously not. The '.' character doesnt even appear in the example you provided.
Generally speaking, compilers give a best guess estimate of where your code is incorrect. If you have missed a semi-colon, for example, the compiler wont know this until some number of following lines (possibly 1 or more) - it will tell you approximately where the error. Some approximations are better than others.
It would be helpful for you to copy the exact compiler output (including line numbers and all else) and then paste your code here (+/- 10 lines from the reported error). Make sure to provide line numbers in your code for us as well.
__________________
My personal site: Utilities for text processing, debugging, testing and plotting
  #3  
Old 27-Mar-2009, 04:37
keko keko is offline
New Member
 
Join Date: Mar 2009
Posts: 2
keko is on a distinguished road

Re: Error: expected primary-expression before '.' token


i made a mistake, the error is actually ',' not '.'

the compiler output is :
tj39@crx557.cro.st.com{models_cpp}64 :g++ -I/sw/gnu_compil/gnu/Linux-RH-WS-3/include/boost-1_35 -L/sw/gnu_compil/gnu/Linux-RH-WS-3/lib/ -lboost_graph-gcc41-mt PTM_model4.cpp
PTM_model4.cpp:154: error: expected primary-expression before ',' token



thanx
  #4  
Old 27-Mar-2009, 11:23
L7Sqr L7Sqr is offline
Member
 
Join Date: Jul 2005
Location: constant limbo
Posts: 234
L7Sqr is a jewel in the roughL7Sqr is a jewel in the rough

Re: Error: expected primary-expression before '.' token


Because
CPP / C++ / C Code:
get(g_level,g);
Resolves to (by tracing back in your code)
CPP / C++ / C Code:
get(property<gate_level_t, int>, g);
And that is not a thing, its a type of thing.
You should be able to do something like
CPP / C++ / C Code:
Graph g;
g_level gl;
... = get(gl, g);
Without much trouble.
__________________
My personal site: Utilities for text processing, debugging, testing and plotting
 
 

Recent GIDBlogInstall Adobe Flash - Without Administrator Rights by LocalTech

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need urgent help with regular expression matching Xilon C Programming Language 7 15-Oct-2006 03:04
Replacing N'th token in a file. kobi_hikri C Programming Language 2 24-Jun-2005 02:00
Can enum have same name as class? crystalattice C++ Forum 3 08-Dec-2004 16:43
storing a token pointer as a string CoreLEx C Programming Language 1 07-Oct-2003 11:33

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 03:44.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.