[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GCC 2.95.2 -frepo option
From: |
Larry I Smith |
Subject: |
Re: GCC 2.95.2 -frepo option |
Date: |
Thu, 19 May 2005 20:34:37 GMT |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050511 |
kaedeRukawa_jp@hotmail.com wrote:
[...]
>
> I tried that, but I still get the same linking problem.
>
> I #included the followings:
>
> #include <algo.h>
> #include <function.h>
> #include <iterator.h>
> #include <list.h>
> #include <deque.h>
> #include <map.h>
> #include <pair.h>
> #include <set.h>
> #include <stack.h>
> #include <vector.h>
>
> I tried using both the .h and non-.h extension .. it still won't work
> =(
> Any other suggestions?
>
I tried this test...
// --- a.h ---
#ifndef A_H
#define A_H
#include <map>
struct Info
{
int x;
int y;
};
class A
{
public:
Info get(int key);
void set(int key, Info data);
private:
std::map<int, Info> mMap;
};
#endif
// --- a.cpp ---
#include <utility>
#include "a.h"
using namespace std;
void A::set(int key, Info data)
{
mMap.insert(make_pair(key, data));
}
Info A::get(int key)
{
map<int, Info>::iterator it = mMap.find(key);
return it->second;
}
// --- a1.cpp ---
#include "a.h"
int main()
{
A test;
Info i1 = { 1, 2 };
Info i2 = { 3, 4 };
test.set(1, i1);
test.set(2, i2);
return 0;
}
Compile test:
>g++ -c -frepo a.cpp
>g++ -o a1 a1.cpp a.o
collect: recompiling a.cpp
collect: relinking
collect: recompiling a.cpp
collect: relinking
Everything worked.
Of course, I'm not using g++ 2.95.2 (I don't have it).
I'm using:
>g++ --version
g++ (GCC) 3.3.4 (pre 3.3.5 20040809)
Is there a reason you need to use '-frepo'?
Does your code compile/work without '-frepo'?
Regards,
Larry
--
Anti-spam address, change each 'X' to '.' to reply directly.
Re: GCC 2.95.2 -frepo option, Bernd Strieder, 2005/05/23