473,394 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Probleme bei DLL-Erstellung und <vector>

Good morning,

I'm trying to write a dll using Dev Cpp 4. I'm able to compile the
following code, but the linker throws an error and no dll is produced:

#include <stdio.h>
#include <windows.h>
#include <vector>

// ... more code ...

vector<charcharSubstring (char *str, int start, int ende)
{
vector<charsubs;

for (int i=start; i<=ende; i++)
{
subs.push_back(str[i]);
}
}

The linker tells me the following:

$_S_oom_malloc alloc template1iOUi+0x1a):maindll.cpp: undefined
reference to `endl(ostream &)`
$_S_oom_malloc alloc template1iOUi+0x1a):maindll.cpp: undefined
reference to `cerr`
$_S_oom_malloc alloc template1iOUi+0x1a):maindll.cpp: undefined
reference to `ostream::operator<<(char const *)`
gcc exited with status 1

When I use the code above in a "normal" program it works fine. Could
someone tell me what I´m doing wrong?
Thanks in advance

Stefan Wagenbrenner

Jul 26 '07 #1
5 1417

<St*****************@googlemail.comwrote in message
news:11*********************@q75g2000hsh.googlegro ups.com...
Good morning,

I'm trying to write a dll using Dev Cpp 4. I'm able to compile the
following code, but the linker throws an error and no dll is produced:

#include <stdio.h>
#include <windows.h>
#include <vector>

// ... more code ...

vector<charcharSubstring (char *str, int start, int ende)
{
vector<charsubs;

for (int i=start; i<=ende; i++)
{
subs.push_back(str[i]);
}
}

The linker tells me the following:

$_S_oom_malloc alloc template1iOUi+0x1a):maindll.cpp: undefined
reference to `endl(ostream &)`
$_S_oom_malloc alloc template1iOUi+0x1a):maindll.cpp: undefined
reference to `cerr`
$_S_oom_malloc alloc template1iOUi+0x1a):maindll.cpp: undefined
reference to `ostream::operator<<(char const *)`
gcc exited with status 1

When I use the code above in a "normal" program it works fine. Could
someone tell me what I´m doing wrong?

Well, endl; is std::endl; but your'e not showiing code using either, making
me think you're not shwoing the entire code? I dont' se a main function so
it's not complete. Try giving us a complete program that produces the
error. You say you expect an .exe to be produced, so need a main().
Jul 26 '07 #2
Jim Langston schrieb:
Well, endl; is std::endl; but your'e not showiing code using either, making
me think you're not shwoing the entire code?
The rest of the code was produced by Dev Cpp, so I omitted it. The code
posted by me was the only code which I wrote.

I dont' se a main function so
it's not complete. Try giving us a complete program that produces the
error. You say you expect an .exe to be produced, so need a main().
I don`t want to produce a .exe, producing a .exe which uses the function
in a main() does not cause an error.
Stefan Wagenbrenner
Jul 26 '07 #3
St*****************@googlemail.com wrote:
Good morning,

I'm trying to write a dll using Dev Cpp 4. I'm able to compile the
following code, but the linker throws an error and no dll is produced:
You'll probably have more luck on a windows group, this a tool rather
than a language problem.

--
Ian Collins.
Jul 26 '07 #4
On Jul 26, 1:16 am, Stefan.Wagenbren...@googlemail.com wrote:
#include <stdio.h>
#include <windows.h>
#include <vector>

// ... more code ...

vector<charcharSubstring (char *str, int start, int ende)
{
Are you missing a

using namespace std;

statement?

Jul 26 '07 #5
On Jul 26, 7:59 am, Nemanja Trifunovic <ntrifuno...@hotmail.com>
wrote:
On Jul 26, 1:16 am, Stefan.Wagenbren...@googlemail.com wrote:
#include <stdio.h>
#include <windows.h>
#include <vector>
// ... more code ...
vector<charcharSubstring (char *str, int start, int ende)
{

Are you missing a

using namespace std;

statement?
Sorry, I only now saw the "linker" part :)

Jul 26 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: zman77 | last post by:
Hi. I've managed to get the C code I need into a dll, and my C# program can access some functions. There are other functions though, and I don't know how to access them from C# because they involve...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.