Click here to Skip to main content
15,902,492 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CFileDialog, user specify directory only ? Pin
Robert Palma Jr.10-Jul-02 11:21
Robert Palma Jr.10-Jul-02 11:21 
GeneralRe: CFileDialog, user specify directory only ? Pin
Michael Dunn11-Jul-02 16:10
sitebuilderMichael Dunn11-Jul-02 16:10 
AnswerRe: CFileDialog, user specify directory only ? Pin
Desmond Mardle10-Jul-02 11:23
Desmond Mardle10-Jul-02 11:23 
AnswerRe: CFileDialog, user specify directory only ? Pin
Desmond Mardle11-Jul-02 4:43
Desmond Mardle11-Jul-02 4:43 
GeneralRe: CFileDialog, user specify directory only ? Pin
Robert Palma Jr.11-Jul-02 10:36
Robert Palma Jr.11-Jul-02 10:36 
QuestionMem Usage??? Pin
Srini Kella10-Jul-02 9:17
Srini Kella10-Jul-02 9:17 
AnswerRe: Mem Usage??? Pin
DanielP10-Jul-02 9:26
DanielP10-Jul-02 9:26 
Generalhelp with templates and __declspec(dllexport) Pin
Roman Nurik10-Jul-02 9:13
Roman Nurik10-Jul-02 9:13 
** NOTE: im working in Visual Studio .NET **

im having two problems relating to templates and the __declspec(dllexport) keywords or directives or whatever you call em

Problem 1


im using std::vector<int> in combination with __declspec(dllexport) when im making an exported class that uses the vector in a DLL project

my code:

struct __declspec(dllexport) MyStruct
{
   int a, b;
};


extern template class __declspec(dllexport) std::vector<MyStruct>;


class __declspec(dllexport) MyClass
{
private:
  std::vector<MyStruct> m_vec;

public:
  // more code here
}


when i try to compile, i get a warning:

c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\vector(35) : warning C4251: 'std::_Vector_val<_Ty,_Alloc>::_Alval' : class 'std::allocator<_Ty>' needs to have dll-interface to be used by clients of class 'std::_Vector_val<_Ty,_Alloc>'
        with
        [
            _Ty=MyStruct,
            _Alloc=std::allocator<MyStruct>
        ]
        and
        [
            _Ty=MyStruct
        ]
        and
        [
            _Ty=MyStruct,
            _Alloc=std::allocator<MyStruct>
        ]
        C:\CPP\Test.h(9) : see reference to class template instantiation 'std::vector<_Ty,_Ax>' being compiled
        with
        [
            _Ty=MyStruct,
            _Ax=std::allocator<MyStruct>
        ]


can someone tell me why the hell that happens if i already used __declspec(dllexport)???

Problem 2


my second problem is an error, not a warning. (to me, warnings are just as bad as errors)

i declare an exported template function like so:

template <class T> __declspec(dllexport) void MyFunction(T tData);


and when i use it, i get an unresolved external!

any ideas?

- Roman -

GeneralRe: help with templates and __declspec(dllexport) Pin
Joaquín M López Muñoz10-Jul-02 9:34
Joaquín M López Muñoz10-Jul-02 9:34 
GeneralRe: help with templates and __declspec(dllexport) Pin
Roman Nurik10-Jul-02 9:36
Roman Nurik10-Jul-02 9:36 
GeneralRe: help with templates and __declspec(dllexport) Pin
Roman Nurik10-Jul-02 9:38
Roman Nurik10-Jul-02 9:38 
GeneralCArray problem with VS.Net Pin
LukeV10-Jul-02 9:11
LukeV10-Jul-02 9:11 
GeneralRe: CArray problem with VS.Net Pin
LukeV10-Jul-02 9:19
LukeV10-Jul-02 9:19 
QuestionToggle Window/Control Visibility? Pin
clintsinger10-Jul-02 9:03
clintsinger10-Jul-02 9:03 
AnswerRe: Toggle Window/Control Visibility? Pin
DanielP10-Jul-02 9:10
DanielP10-Jul-02 9:10 
QuestionWINAPI Function - NT Only!? Pin
carp10-Jul-02 8:42
carp10-Jul-02 8:42 
AnswerRe: WINAPI Function - NT Only!? Pin
Jeremy Falcon10-Jul-02 8:57
professionalJeremy Falcon10-Jul-02 8:57 
AnswerRe: WINAPI Function - NT Only!? Pin
Chad Koehler10-Jul-02 10:16
Chad Koehler10-Jul-02 10:16 
AnswerRe: WINAPI Function - NT Only!? Pin
Mike Nordell11-Jul-02 1:36
Mike Nordell11-Jul-02 1:36 
Generalbuttons don't change color in dialog Pin
jimNLX10-Jul-02 8:04
jimNLX10-Jul-02 8:04 
GeneralRe: buttons don't change color in dialog Pin
Joaquín M López Muñoz10-Jul-02 8:18
Joaquín M López Muñoz10-Jul-02 8:18 
GeneralRe: buttons don't change color in dialog Pin
jimNLX10-Jul-02 9:18
jimNLX10-Jul-02 9:18 
GeneralRe: buttons don't change color in dialog Pin
Joaquín M López Muñoz10-Jul-02 9:22
Joaquín M López Muñoz10-Jul-02 9:22 
GeneralRe: buttons don't change color in dialog Pin
jimNLX10-Jul-02 9:25
jimNLX10-Jul-02 9:25 
Generalmemory leaks... Pin
Srini Kella10-Jul-02 7:42
Srini Kella10-Jul-02 7:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.