I have found a program and tried using 'DEV C++' but it only reported an error report. I later then discovered that is was because 'DEV C++' used C++ when the code was designed for just plane C. I have searched the web and this forum but only found two relevant threads from this forum (as shown below):
http://www.daniweb.com/forums/showthread.php?t=33446&highlight=c+compiler
http://www.daniweb.com/forums/showthread.php?t=45333&highlight=c+compiler
However, this still does not answer my question. And that is where to find a FREE or cheap compiler which compiles only 'C' code and not C++.

Dani AI

Generated

A few clarifications and practical fixes that address the actual problem raised in this thread.

The reported failure is almost always a makefile parsing issue, not a limitation of the compiler. Dev-C++ (and MinGW/GCC) will compile plain C if the source files are .c and the gcc driver is used. The common cause of the "multiple target patterns" symptom is unescaped spaces or misplaced quotes in target/prerequisite lines (for example when a path under Program Files is inserted directly into a target). Quotes are fine inside command recipes but tend to break make when placed around target names or prerequisites.

Practical steps to resolve the build:

  • Move the project to a path with no spaces (for example C:\projects\encoder) or use the Windows short-name (Progra~1) so make sees no embedded spaces.

  • Edit the makefile so targets/prereqs do not contain unquoted spaces. Define a directory variable and use it in targets; keep any quoting to the command lines only. Example pattern:

    SRCDIR = D:/Progra~1/Dev-Cpp/Templates
    OBJ = $(SRCDIR)/encoder.o encoder7_private.res
    
    encoder7.exe: $(OBJ)
      gcc -o $@ $(OBJ) -L"D:/Progra~1/Dev-Cpp/lib" -mwindows
  • For a quick sanity check, try compiling the C file directly from a command prompt with gcc -std=c99 -Wall -O2 -c encoder.c and, if present, compile resources with windres, then link with gcc so the minimal build path is visible and easier to debug.

Also verify the project README/INSTALL for required toolchain pieces: if the source expects MSVC-specific project files, assembler (nasm) or compiler-specific pragmas, a straight MinGW build may require code changes or the matching toolchain. In this thread , and pointed toward those possibilities; later reported success with a Windows-oriented C toolchain. These diagnostic steps isolate makefile/path issues first, then toolchain mismatches second.

Recommended Answers

All 11 Replies

DEV C++ compiles C or C++ just fine. What is the reported error ?

The links you posted give me a 404 page not found error.

Below is the error:
# Project: Project1
# Makefile created by Dev-C++

CPP = g++.exe -D__DEBUG__
CC = gcc.exe -D__DEBUG__
WINDRES = windres.exe
RES = encoder7_private.res
OBJ = "D:/Program Files/Dev-Cpp/Templates/encoder.o" $(RES)
LINKOBJ = "D:/Program Files/Dev-Cpp/Templates/encoder.o" $(RES)
LIBS = -L"D:/Program Files/Dev-Cpp/lib" -mwindows
INCS = -I"D:/Program Files/Dev-Cpp/include"
CXXINCS = -I"D:/Program Files/Dev-Cpp/include/c++" -I"D:/Program Files/Dev-Cpp/include/c++/mingw32" -I"D:/Program Files/Dev-Cpp/include/c++/backward" -I"D:/Program Files/Dev-Cpp/include"
BIN = encoder7.exe
CXXFLAGS = $(CXXINCS) -ansi -traditional-cpp -w -fdollar-in-identifiers -g3
CFLAGS = $(INCS) -ansi -traditional-cpp -w -fdollar-in-identifiers -g3

.PHONY: all all-before all-after clean clean-custom

all: all-before encoder7.exe all-after


clean: clean-custom
rm -f $(OBJ) $(BIN)

$(BIN): $(LINKOBJ)
$(CPP) $(LINKOBJ) -o "encoder7.exe" $(LIBS)

"D:/Program Files/Dev-Cpp/Templates/encoder.o": D:/Program\ Files/Dev-Cpp/Templates/encoder.c
$(CC) -c "D:/Program Files/Dev-Cpp/Templates/encoder.c" -o "D:/Program Files/Dev-Cpp/Templates/encoder.o" $(CFLAGS)

encoder7_private.res: encoder7_
$(WINDRES) -i encoder7_ -I rc -o encoder7_private.res -O coff

------------------------------
and it says [Build Error] multiple target patterns. And for the links above (which I have just checked, the way to get to the is be searching this forum for 'c compiler' (in threads) and they are in the first 3 pages.

One of the things that Dev C++ gets mixed up with is when you use a code like:
#include "../encoder.h"
It gets mixed up with the .h

Ok I'm not too sure. But this might have something to do with dependancy. Is there more than 1 makefile in your download?

One of Dev-C++ shortfalls is it can't compile multiple projects all at once. You have to compile them one at a time, and you have to know manually in which order to build them.

Member Avatar for Member #46692

What!? just save the file as something.c and hit the compile button. Job done.

commented: That's all it takes :) +11

The thing is, the source code did not come with a make file and I think dev C++ is having trouble making it. Below is the link to the source code (and I hope this link works).
http://www.xvid.org/Downloads.43.0.html?&tx_quickpoll_pi1[go]=savevote#c25
So now I am trying to contact technical support for this source code to see what compiler they recommend.

read the INSTALL file and it will tell you that they used VC++ 6 and NASM assembler.

2.a/ Requirements.
------------------

- MS VisualDev 6 Processor Pack 5 or MS VisualDev 7
- nasm installed as 'nasm' in the msvc binary search paths.

Well if you want a simple command line compiler then you can go for DJGPP It'll work good too.

Thanks for the compilers. I think I will be able to take it on from here. And I have found that Pelles C is a good compiler.

*Solved*

I have found a program and tried using 'DEV C++' but it only reported an error report. I later then discovered that is was because 'DEV C++' used C++ when the code was designed for just plane C. I have searched the web and this forum but only found two relevant threads from this forum (as shown below):
http://www.daniweb.com/forums/thread33446.html&highlight=c+compiler
http://www.daniweb.com/forums/thread45333.html&highlight=c+compiler
However, this still does not answer my question. And that is where to find a FREE or cheap compiler which compiles only 'C' code and not C++.

cwarn23, you might look at LLC-Win32, which is free for PERSONAL use, or try Pelles, which is totally free. I have been using LLC-Win32 to learn C, using Gookin's C for Dummies (6 books in one). However, Gookin uses the Linux C compiler and I have run into problems with the implementation of subroutines (bad word, functions or procedures in C). I intend to try to use the Pelles C Compiler. However, the LLC-Win32 does have some good documentation. Google for these or go to http://www.thefreecountry.com/
Best of luck
Kocmotex

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.